Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/DikeHeightAssessmentOutputCreateExtensions.cs
===================================================================
diff -u -r8cb270db5fbcb82f19d6f3a390f083e9e0516d8c -reec680fe322aea5d1ecf8fdf1f14a273afdf6c53
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/DikeHeightAssessmentOutputCreateExtensions.cs (.../DikeHeightAssessmentOutputCreateExtensions.cs) (revision 8cb270db5fbcb82f19d6f3a390f083e9e0516d8c)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/DikeHeightAssessmentOutputCreateExtensions.cs (.../DikeHeightAssessmentOutputCreateExtensions.cs) (revision eec680fe322aea5d1ecf8fdf1f14a273afdf6c53)
@@ -19,23 +19,34 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Application.Ringtoets.Storage.DbContext;
using Ringtoets.GrassCoverErosionInwards.Data;
namespace Application.Ringtoets.Storage.Create.GrassCoverErosionInwards
{
///
- /// Extension methods for related to creating a .
+ /// Extension methods for
+ /// related to creating a
+ /// or a .
///
internal static class DikeHeightAssessmentOutputCreateExtensions
{
///
- /// Creates a based on the information of the .
+ /// Creates a
+ /// based on the information of the .
///
/// The output to create a database entity for.
/// A new .
- internal static GrassCoverErosionInwardsDikeHeightOutputEntity Create(this SubCalculationAssessmentOutput output)
+ /// Thrown when
+ /// is null.
+ internal static GrassCoverErosionInwardsDikeHeightOutputEntity CreateDikeHeight(this SubCalculationAssessmentOutput output)
{
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
return new GrassCoverErosionInwardsDikeHeightOutputEntity
{
DikeHeight = double.IsNaN(output.Result)
@@ -56,5 +67,41 @@
CalculationConvergence = (byte) output.CalculationConvergence
};
}
+
+ ///
+ /// Creates a
+ /// based on the information of the .
+ ///
+ /// The output to create a database entity for.
+ /// A new .
+ /// Thrown when
+ /// is null.
+ internal static GrassCoverErosionInwardsOvertoppingRateOutputEntity CreateOvertoppingRate(this SubCalculationAssessmentOutput output)
+ {
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
+ return new GrassCoverErosionInwardsOvertoppingRateOutputEntity
+ {
+ OvertoppingRate = double.IsNaN(output.Result)
+ ? (double?) null
+ : output.Result,
+ TargetProbability = double.IsNaN(output.TargetProbability)
+ ? (double?) null
+ : output.TargetProbability,
+ TargetReliability = double.IsNaN(output.TargetReliability)
+ ? (double?) null
+ : output.TargetReliability,
+ CalculatedProbability = double.IsNaN(output.CalculatedProbability)
+ ? (double?) null
+ : output.CalculatedProbability,
+ CalculatedReliability = double.IsNaN(output.CalculatedReliability)
+ ? (double?) null
+ : output.CalculatedReliability,
+ CalculationConvergence = (byte) output.CalculationConvergence
+ };
+ }
}
}
\ No newline at end of file