Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CreateConversionCollector.cs
===================================================================
diff -u -rbc9552772d4e6a6bd786dfcaef808da1964e8c53 -rd3cfb50d8334298aff5314958fc9fa29846435a5
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CreateConversionCollector.cs (.../CreateConversionCollector.cs) (revision bc9552772d4e6a6bd786dfcaef808da1964e8c53)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CreateConversionCollector.cs (.../CreateConversionCollector.cs) (revision d3cfb50d8334298aff5314958fc9fa29846435a5)
@@ -13,9 +13,9 @@
namespace Application.Ringtoets.Storage.Create
{
///
- /// This class can be used to keep track of create operations on a database. When all operations have been performed, then
- /// the collected information can be used, for example, to transfer the ids assigned to the created database instances
- /// back to the data model.
+ /// This class can be used to keep track of create operations on a database. This information can used to reuse previously created
+ /// objects. When all operations have been performed, then the collected information can be used to transfer the ids assigned to
+ /// the created database instances back to the data model.
///
public class CreateConversionCollector
{
@@ -28,56 +28,163 @@
private readonly Dictionary soilProfiles = new Dictionary(new ReferenceEqualityComparer());
private readonly Dictionary soilLayers = new Dictionary(new ReferenceEqualityComparer());
- internal void Add(ProjectEntity entity, Project model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(ProjectEntity entity, Project model)
{
- Add(projects, entity, model);
+ Create(projects, entity, model);
}
- internal void Add(AssessmentSectionEntity entity, AssessmentSection model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(AssessmentSectionEntity entity, AssessmentSection model)
{
- Add(assessmentSections, entity, model);
+ Create(assessmentSections, entity, model);
}
- internal void Add(HydraulicLocationEntity entity, HydraulicBoundaryLocation model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(HydraulicLocationEntity entity, HydraulicBoundaryLocation model)
{
- Add(hydraulicLocations, entity, model);
+ Create(hydraulicLocations, entity, model);
}
- internal void Add(FailureMechanismEntity entity, FailureMechanismBase model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(FailureMechanismEntity entity, FailureMechanismBase model)
{
- Add(failureMechanisms, entity, model);
+ Create(failureMechanisms, entity, model);
}
- internal void Add(StochasticSoilModelEntity entity, StochasticSoilModel model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(StochasticSoilModelEntity entity, StochasticSoilModel model)
{
- Add(stochasticSoilModels, entity, model);
+ Create(stochasticSoilModels, entity, model);
}
- internal void Add(StochasticSoilProfileEntity entity, StochasticSoilProfile model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(StochasticSoilProfileEntity entity, StochasticSoilProfile model)
{
- Add(stochasticSoilProfiles, entity, model);
+ Create(stochasticSoilProfiles, entity, model);
}
- internal void Add(SoilProfileEntity entity, PipingSoilProfile model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(SoilProfileEntity entity, PipingSoilProfile model)
{
- Add(soilProfiles, entity, model);
+ Create(soilProfiles, entity, model);
}
- internal void Add(SoilLayerEntity entity, PipingSoilLayer model)
+ ///
+ /// Registers a create operation for and the that
+ /// was constructed with the information.
+ ///
+ /// The that was constructed.
+ /// The new which needed to be created.
+ /// Thrown when either:
+ ///
+ /// - is null
+ /// - is null
+ ///
+ internal void Create(SoilLayerEntity entity, PipingSoilLayer model)
{
- Add(soilLayers, entity, model);
+ Create(soilLayers, entity, model);
}
+ ///
+ /// Checks whether a create operations has been registered for the given .
+ ///
+ /// The to check for.
+ /// true if the was created before, false otherwise.
+ /// Thrown when is null.
internal bool Contains(PipingSoilProfile model)
{
return ContainsValue(soilProfiles, model);
}
+ ///
+ /// Obtains the which was created for the given .
+ ///
+ /// The for which a read operation has been registerd.
+ /// The constructed .
+ /// Thrown when is null.
+ /// Thrown when no create operation has been registered for
+ /// .
+ /// Use to find out whether a create operation has been registered for
+ /// .
internal SoilProfileEntity Get(PipingSoilProfile model)
{
return Get(soilProfiles, model);
}
+ ///
+ /// Transfer ids from the created entities to the domain model objects' property.
+ ///
internal void TransferIds()
{
foreach (var entity in projects.Keys)
@@ -131,7 +238,7 @@
return collection.ContainsValue(model);
}
- private void Add(Dictionary collection, T entity, U model)
+ private void Create(Dictionary collection, T entity, U model)
{
if (entity == null)
{