private static void Create <T>(this StructuresInputBase <T> input, IStructuresCalculationEntity entityToUpdate, PersistenceRegistry registry) where T : StructureBase { if (entityToUpdate == null) { throw new ArgumentNullException(nameof(entityToUpdate)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } entityToUpdate.StormDurationMean = input.StormDuration.Mean.ToNaNAsNull(); entityToUpdate.StructureNormalOrientation = input.StructureNormalOrientation.ToNaNAsNull(); entityToUpdate.FailureProbabilityStructureWithErosion = input.FailureProbabilityStructureWithErosion; if (input.HydraulicBoundaryLocation != null) { entityToUpdate.HydraulicLocationEntity = registry.Get(input.HydraulicBoundaryLocation); } if (input.ForeshoreProfile != null) { entityToUpdate.ForeshoreProfileEntity = registry.Get(input.ForeshoreProfile); } entityToUpdate.UseForeshore = Convert.ToByte(input.UseForeshore); entityToUpdate.UseBreakWater = Convert.ToByte(input.UseBreakWater); entityToUpdate.BreakWaterType = Convert.ToByte(input.BreakWater.Type); entityToUpdate.BreakWaterHeight = input.BreakWater.Height.ToNaNAsNull(); entityToUpdate.AllowedLevelIncreaseStorageMean = input.AllowedLevelIncreaseStorage.Mean.ToNaNAsNull(); entityToUpdate.AllowedLevelIncreaseStorageStandardDeviation = input.AllowedLevelIncreaseStorage.StandardDeviation.ToNaNAsNull(); entityToUpdate.StorageStructureAreaMean = input.StorageStructureArea.Mean.ToNaNAsNull(); entityToUpdate.StorageStructureAreaCoefficientOfVariation = input.StorageStructureArea.CoefficientOfVariation.ToNaNAsNull(); entityToUpdate.FlowWidthAtBottomProtectionMean = input.FlowWidthAtBottomProtection.Mean.ToNaNAsNull(); entityToUpdate.FlowWidthAtBottomProtectionStandardDeviation = input.FlowWidthAtBottomProtection.StandardDeviation.ToNaNAsNull(); entityToUpdate.CriticalOvertoppingDischargeMean = input.CriticalOvertoppingDischarge.Mean.ToNaNAsNull(); entityToUpdate.CriticalOvertoppingDischargeCoefficientOfVariation = input.CriticalOvertoppingDischarge.CoefficientOfVariation.ToNaNAsNull(); entityToUpdate.WidthFlowAperturesMean = input.WidthFlowApertures.Mean.ToNaNAsNull(); entityToUpdate.WidthFlowAperturesStandardDeviation = input.WidthFlowApertures.StandardDeviation.ToNaNAsNull(); entityToUpdate.ShouldIllustrationPointsBeCalculated = Convert.ToByte(input.ShouldIllustrationPointsBeCalculated); }
/// <summary> /// Creates a <see cref="HydraulicLocationCalculationForTargetProbabilityCollectionEntity"/> based on the information /// of the <paramref name="calculations"/>. /// </summary> /// <param name="calculations"> /// The collection of <see cref="HydraulicBoundaryLocationCalculationsForTargetProbability"/> /// to create a database entity for. /// </param> /// <param name="calculationType">The type of calculation the entity should be created for.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <returns>A new <see cref="HydraulicLocationCalculationForTargetProbabilityCollectionEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculations"/> or <paramref name="registry"/> is <c>null</c>.</exception> internal static HydraulicLocationCalculationForTargetProbabilityCollectionEntity Create(this HydraulicBoundaryLocationCalculationsForTargetProbability calculations, HydraulicBoundaryLocationCalculationType calculationType, int order, PersistenceRegistry registry) { if (calculations == null) { throw new ArgumentNullException(nameof(calculations)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(calculations)) { return(registry.Get(calculations)); } var collectionEntity = new HydraulicLocationCalculationForTargetProbabilityCollectionEntity { HydraulicBoundaryLocationCalculationType = Convert.ToByte(calculationType), TargetProbability = calculations.TargetProbability, Order = order }; foreach (HydraulicBoundaryLocationCalculation calculation in calculations.HydraulicBoundaryLocationCalculations) { collectionEntity.HydraulicLocationCalculationEntities.Add(calculation.Create(registry)); } registry.Register(collectionEntity, calculations); return(collectionEntity); }
/// <summary> /// Creates a <see cref="ForeshoreProfileEntity"/> based on the information of the <see cref="ForeshoreProfile"/>. /// </summary> /// <param name="foreshoreProfile">The foreshore profile to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">The index at which <paramref name="foreshoreProfile"/> resides within its parent.</param> /// <returns>A new <see cref="ForeshoreProfileEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> is <c>null</c>.</exception> internal static ForeshoreProfileEntity Create(this ForeshoreProfile foreshoreProfile, PersistenceRegistry registry, int order) { if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(foreshoreProfile)) { return(registry.Get(foreshoreProfile)); } var foreshoreProfileEntity = new ForeshoreProfileEntity { Id = foreshoreProfile.Id.DeepClone(), Name = foreshoreProfile.Name.DeepClone(), GeometryXml = new Point2DCollectionXmlSerializer().ToXml(foreshoreProfile.Geometry), X = foreshoreProfile.WorldReferencePoint.X, Y = foreshoreProfile.WorldReferencePoint.Y, X0 = foreshoreProfile.X0, Orientation = foreshoreProfile.Orientation, Order = order }; if (foreshoreProfile.HasBreakWater) { foreshoreProfileEntity.BreakWaterHeight = foreshoreProfile.BreakWater.Height; foreshoreProfileEntity.BreakWaterType = Convert.ToByte(foreshoreProfile.BreakWater.Type); } registry.Register(foreshoreProfileEntity, foreshoreProfile); return(foreshoreProfileEntity); }
/// <summary> /// Creates a <see cref="HydraulicLocationEntity"/> based on the information of the <see cref="HydraulicBoundaryLocation"/>. /// </summary> /// <param name="location">The location to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <param name="order">Index at which this instance resides inside its parent container.</param> /// <returns>A new <see cref="HydraulicLocationEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="registry"/> or <param name="location"></param> /// is <c>null</c>.</exception> internal static HydraulicLocationEntity Create(this HydraulicBoundaryLocation location, PersistenceRegistry registry, int order) { if (location == null) { throw new ArgumentNullException(nameof(location)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } if (registry.Contains(location)) { return(registry.Get(location)); } var entity = new HydraulicLocationEntity { LocationId = location.Id, Name = location.Name.DeepClone(), LocationX = location.Location.X.ToNaNAsNull(), LocationY = location.Location.Y.ToNaNAsNull(), Order = order }; registry.Register(entity, location); return(entity); }
private static void AddEntitiesForSectionResults( IEnumerable <NonAdoptableWithProfileProbabilityFailureMechanismSectionResult> sectionResults, PersistenceRegistry registry) { foreach (NonAdoptableWithProfileProbabilityFailureMechanismSectionResult sectionResult in sectionResults) { NonAdoptableWithProfileProbabilityFailureMechanismSectionResultEntity sectionResultEntity = sectionResult.Create(); FailureMechanismSectionEntity section = registry.Get(sectionResult.Section); section.NonAdoptableWithProfileProbabilityFailureMechanismSectionResultEntities.Add(sectionResultEntity); } }
private static void SetHeightStructuresInputValues(HeightStructuresCalculationEntity entity, HeightStructuresInput input, PersistenceRegistry registry) { input.Create(entity, registry); if (input.Structure != null) { entity.HeightStructureEntity = registry.Get(input.Structure); } entity.DeviationWaveDirection = input.DeviationWaveDirection.ToNaNAsNull(); entity.ModelFactorSuperCriticalFlowMean = input.ModelFactorSuperCriticalFlow.Mean.ToNaNAsNull(); entity.LevelCrestStructureMean = input.LevelCrestStructure.Mean.ToNaNAsNull(); entity.LevelCrestStructureStandardDeviation = input.LevelCrestStructure.StandardDeviation.ToNaNAsNull(); }
private static void SetClosingStructuresInputValues(ClosingStructuresCalculationEntity entity, ClosingStructuresInput input, PersistenceRegistry registry) { input.Create(entity, registry); if (input.Structure != null) { entity.ClosingStructureEntity = registry.Get(input.Structure); } entity.InflowModelType = Convert.ToByte(input.InflowModelType); entity.InsideWaterLevelMean = input.InsideWaterLevel.Mean.ToNaNAsNull(); entity.InsideWaterLevelStandardDeviation = input.InsideWaterLevel.StandardDeviation.ToNaNAsNull(); entity.DeviationWaveDirection = input.DeviationWaveDirection.ToNaNAsNull(); entity.ModelFactorSuperCriticalFlowMean = input.ModelFactorSuperCriticalFlow.Mean.ToNaNAsNull(); entity.DrainCoefficientMean = input.DrainCoefficient.Mean.ToNaNAsNull(); entity.DrainCoefficientStandardDeviation = input.DrainCoefficient.StandardDeviation.ToNaNAsNull(); entity.FactorStormDurationOpenStructure = input.FactorStormDurationOpenStructure.ToNaNAsNull(); entity.ThresholdHeightOpenWeirMean = input.ThresholdHeightOpenWeir.Mean.ToNaNAsNull(); entity.ThresholdHeightOpenWeirStandardDeviation = input.ThresholdHeightOpenWeir.StandardDeviation.ToNaNAsNull(); entity.AreaFlowAperturesMean = input.AreaFlowApertures.Mean.ToNaNAsNull(); entity.AreaFlowAperturesStandardDeviation = input.AreaFlowApertures.StandardDeviation.ToNaNAsNull(); entity.FailureProbabilityOpenStructure = input.FailureProbabilityOpenStructure; entity.FailureProbabilityReparation = input.FailureProbabilityReparation; entity.IdenticalApertures = input.IdenticalApertures; entity.LevelCrestStructureNotClosingMean = input.LevelCrestStructureNotClosing.Mean.ToNaNAsNull(); entity.LevelCrestStructureNotClosingStandardDeviation = input.LevelCrestStructureNotClosing.StandardDeviation.ToNaNAsNull(); entity.ProbabilityOpenStructureBeforeFlooding = input.ProbabilityOpenStructureBeforeFlooding; }
/// <summary> /// Creates a <see cref="HydraulicLocationCalculationEntity"/> based on the information of /// <see cref="HydraulicBoundaryLocationCalculation"/>. /// </summary> /// <param name="calculation">The calculation to create a database entity for.</param> /// <param name="registry">The object keeping track of create operations.</param> /// <returns>A new <see cref="HydraulicLocationCalculationEntity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> internal static HydraulicLocationCalculationEntity Create(this HydraulicBoundaryLocationCalculation calculation, PersistenceRegistry registry) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } if (registry == null) { throw new ArgumentNullException(nameof(registry)); } var hydraulicLocationCalculationEntity = new HydraulicLocationCalculationEntity { ShouldIllustrationPointsBeCalculated = Convert.ToByte(calculation.InputParameters.ShouldIllustrationPointsBeCalculated), HydraulicLocationEntity = registry.Get(calculation.HydraulicBoundaryLocation) }; CreateHydraulicBoundaryLocationCalculationOutput(hydraulicLocationCalculationEntity, calculation.Output); return(hydraulicLocationCalculationEntity); }
private static void SetStabilityPointStructuresInputValues(StabilityPointStructuresCalculationEntity entity, StabilityPointStructuresInput input, PersistenceRegistry registry) { input.Create(entity, registry); if (input.Structure != null) { entity.StabilityPointStructureEntity = registry.Get(input.Structure); } entity.InsideWaterLevelMean = input.InsideWaterLevel.Mean.ToNaNAsNull(); entity.InsideWaterLevelStandardDeviation = input.InsideWaterLevel.StandardDeviation.ToNaNAsNull(); entity.ThresholdHeightOpenWeirMean = input.ThresholdHeightOpenWeir.Mean.ToNaNAsNull(); entity.ThresholdHeightOpenWeirStandardDeviation = input.ThresholdHeightOpenWeir.StandardDeviation.ToNaNAsNull(); entity.ConstructiveStrengthLinearLoadModelMean = input.ConstructiveStrengthLinearLoadModel.Mean.ToNaNAsNull(); entity.ConstructiveStrengthLinearLoadModelCoefficientOfVariation = input.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation.ToNaNAsNull(); entity.ConstructiveStrengthQuadraticLoadModelMean = input.ConstructiveStrengthQuadraticLoadModel.Mean.ToNaNAsNull(); entity.ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation = input.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation.ToNaNAsNull(); entity.BankWidthMean = input.BankWidth.Mean.ToNaNAsNull(); entity.BankWidthStandardDeviation = input.BankWidth.StandardDeviation.ToNaNAsNull(); entity.InsideWaterLevelFailureConstructionMean = input.InsideWaterLevelFailureConstruction.Mean.ToNaNAsNull(); entity.InsideWaterLevelFailureConstructionStandardDeviation = input.InsideWaterLevelFailureConstruction.StandardDeviation.ToNaNAsNull(); entity.EvaluationLevel = input.EvaluationLevel.ToNaNAsNull(); entity.LevelCrestStructureMean = input.LevelCrestStructure.Mean.ToNaNAsNull(); entity.LevelCrestStructureStandardDeviation = input.LevelCrestStructure.StandardDeviation.ToNaNAsNull(); entity.VerticalDistance = input.VerticalDistance.ToNaNAsNull(); entity.FailureProbabilityRepairClosure = input.FailureProbabilityRepairClosure; entity.FailureCollisionEnergyMean = input.FailureCollisionEnergy.Mean.ToNaNAsNull(); entity.FailureCollisionEnergyCoefficientOfVariation = input.FailureCollisionEnergy.CoefficientOfVariation.ToNaNAsNull(); entity.ShipMassMean = input.ShipMass.Mean.ToNaNAsNull(); entity.ShipMassCoefficientOfVariation = input.ShipMass.CoefficientOfVariation.ToNaNAsNull(); entity.ShipVelocityMean = input.ShipVelocity.Mean.ToNaNAsNull(); entity.ShipVelocityCoefficientOfVariation = input.ShipVelocity.CoefficientOfVariation.ToNaNAsNull(); entity.LevellingCount = input.LevellingCount; entity.ProbabilityCollisionSecondaryStructure = input.ProbabilityCollisionSecondaryStructure; entity.FlowVelocityStructureClosableMean = input.FlowVelocityStructureClosable.Mean.ToNaNAsNull(); entity.StabilityLinearLoadModelMean = input.StabilityLinearLoadModel.Mean.ToNaNAsNull(); entity.StabilityLinearLoadModelCoefficientOfVariation = input.StabilityLinearLoadModel.CoefficientOfVariation.ToNaNAsNull(); entity.StabilityQuadraticLoadModelMean = input.StabilityQuadraticLoadModel.Mean.ToNaNAsNull(); entity.StabilityQuadraticLoadModelCoefficientOfVariation = input.StabilityQuadraticLoadModel.CoefficientOfVariation.ToNaNAsNull(); entity.AreaFlowAperturesMean = input.AreaFlowApertures.Mean.ToNaNAsNull(); entity.AreaFlowAperturesStandardDeviation = input.AreaFlowApertures.StandardDeviation.ToNaNAsNull(); entity.InflowModelType = Convert.ToByte(input.InflowModelType); entity.LoadSchematizationType = Convert.ToByte(input.LoadSchematizationType); entity.VolumicWeightWater = input.VolumicWeightWater.ToNaNAsNull(); entity.FactorStormDurationOpenStructure = input.FactorStormDurationOpenStructure.ToNaNAsNull(); entity.DrainCoefficientMean = input.DrainCoefficient.Mean.ToNaNAsNull(); entity.DrainCoefficientStandardDeviation = input.DrainCoefficient.StandardDeviation.ToNaNAsNull(); }