Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PersistenceRegistry.cs =================================================================== diff -u -r2797cef80ee8fe17fe77116367e9b3d926945c7b -r678685141f0211ca24ce5c03fc5eb05cc99f0f48 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PersistenceRegistry.cs (.../PersistenceRegistry.cs) (revision 2797cef80ee8fe17fe77116367e9b3d926945c7b) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PersistenceRegistry.cs (.../PersistenceRegistry.cs) (revision 678685141f0211ca24ce5c03fc5eb05cc99f0f48) @@ -53,6 +53,7 @@ private readonly Dictionary hydraulicLocations = new Dictionary(new ReferenceEqualityComparer()); private readonly Dictionary calculationGroups = new Dictionary(new ReferenceEqualityComparer()); private readonly Dictionary pipingCalculations = new Dictionary(new ReferenceEqualityComparer()); + private readonly Dictionary pipingOutputs = new Dictionary(new ReferenceEqualityComparer()); private readonly Dictionary stochasticSoilModels = new Dictionary(new ReferenceEqualityComparer()); private readonly Dictionary stochasticSoilProfiles = new Dictionary(new ReferenceEqualityComparer()); private readonly Dictionary soilProfiles = new Dictionary(new ReferenceEqualityComparer()); @@ -114,6 +115,22 @@ /// Registers a create or update operation for and the /// that was constructed with the information. /// + /// The that was registered. + /// The which needed to registered. + /// Thrown when either: + /// + /// is null + /// is null + /// + public void Register(PipingCalculationOutputEntity entity, PipingOutput model) + { + Register(pipingOutputs, entity, model); + } + + /// + /// Registers a create or update operation for and the + /// that was constructed with the information. + /// /// The that was registered. /// The which needed to be registered. /// Thrown when either: @@ -447,6 +464,17 @@ Register(characteristicPoints, entity, model); } + /// + /// Registers a create or update operation for and the + /// that was constructed with the information. + /// + /// The that is being registered. + /// The that it being registered. + /// Thrown when either: + /// + /// is null + /// is null + /// internal void Register(PipingFailureMechanismMetaEntity entity, PipingProbabilityAssessmentInput model) { Register(pipingProbabilityAssessmentInputs, entity, model); @@ -492,6 +520,11 @@ pipingCalculations[entity].StorageId = entity.PipingCalculationEntityId; } + foreach (var entity in pipingOutputs.Keys) + { + pipingOutputs[entity].StorageId = entity.PipingCalculationOutputEntityId; + } + foreach (var entity in stochasticSoilModels.Keys) { stochasticSoilModels[entity].StorageId = entity.StochasticSoilModelEntityId; @@ -614,6 +647,17 @@ } dbContext.PipingCalculationEntities.RemoveRange(orphanedPipingCalculationEntities); + IList orphanedPipingCalculationOutputEntities = new List(); + foreach (PipingCalculationOutputEntity pipingCalculationOutputEntity in dbContext.PipingCalculationOutputEntities + .Where(e => e.PipingCalculationOutputEntityId > 0)) + { + if (!pipingOutputs.ContainsKey(pipingCalculationOutputEntity)) + { + orphanedPipingCalculationOutputEntities.Add(pipingCalculationOutputEntity); + } + } + dbContext.PipingCalculationOutputEntities.RemoveRange(orphanedPipingCalculationOutputEntities); + IList orphanedStochasticSoilModelEntities = new List(); foreach (StochasticSoilModelEntity stochasticSoilModelEntity in dbContext.StochasticSoilModelEntities .Where(e => e.StochasticSoilModelEntityId > 0))