Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -221,9 +221,6 @@
RingtoetsEntities.tt
-
- RingtoetsEntities.tt
-
RingtoetsEntities.tt
@@ -272,7 +269,6 @@
-
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilModelCreateExtensions.cs
===================================================================
diff -u -r01ff2c58c13df8f42661ae3e446dc2caaa94247e -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilModelCreateExtensions.cs (.../StochasticSoilModelCreateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilModelCreateExtensions.cs (.../StochasticSoilModelCreateExtensions.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -21,10 +21,9 @@
using System;
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.DbContext;
-using Core.Common.Base.Geometry;
-
using Ringtoets.Piping.Data;
namespace Application.Ringtoets.Storage.Create.Piping
@@ -55,11 +54,11 @@
var entity = new StochasticSoilModelEntity
{
Name = model.Name,
- SegmentName = model.SegmentName
+ SegmentName = model.SegmentName,
+ SegmentPoints = new Point2DBinaryConverter().ToBytes(model.Geometry)
};
AddEntitiesForStochasticSoilProfiles(model, registry, entity);
- AddEntitiesForGeometryPoints(model, entity);
registry.Register(entity, model);
return entity;
@@ -72,15 +71,5 @@
entity.StochasticSoilProfileEntities.Add(stochasticSoilProfile.Create(registry));
}
}
-
- private static void AddEntitiesForGeometryPoints(StochasticSoilModel model, StochasticSoilModelEntity entity)
- {
- for (int i = 0; i < model.Geometry.Count; i++)
- {
- Point2D geometryPoint = model.Geometry[i];
- StochasticSoilModelSegmentPointEntity pointEntity = geometryPoint.CreateStochasticSoilModelSegmentPointEntity(i);
- entity.StochasticSoilModelSegmentPointEntities.Add(pointEntity);
- }
- }
}
}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Point2DCreateExtensions.cs
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Point2DCreateExtensions.cs (.../Point2DCreateExtensions.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Point2DCreateExtensions.cs (.../Point2DCreateExtensions.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -65,25 +65,5 @@
return entity;
}
-
- ///
- /// Creates a based on the
- /// information of the .
- ///
- /// The point to create a database entity for.
- /// A value representing the position of the point in an
- /// ordered collection.
- /// A new .
- internal static StochasticSoilModelSegmentPointEntity CreateStochasticSoilModelSegmentPointEntity(this Point2D point, int order)
- {
- var entity = new StochasticSoilModelSegmentPointEntity
- {
- X = point.X.ToNaNAsNull(),
- Y = point.Y.ToNaNAsNull(),
- Order = order
- };
-
- return entity;
- }
}
}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -1,6 +1,6 @@
/* ---------------------------------------------------- */
/* Generated by Enterprise Architect Version 12.0 */
-/* Created On : 26-jul-2016 11:17:27 */
+/* Created On : 28-jul-2016 16:23:20 */
/* DBMS : SQLite */
/* ---------------------------------------------------- */
@@ -66,9 +66,6 @@
DROP TABLE IF EXISTS 'PipingCalculationOutputEntity'
;
-DROP TABLE IF EXISTS 'StochasticSoilModelSegmentPointEntity'
-;
-
DROP TABLE IF EXISTS 'CharacteristicPointEntity'
;
@@ -364,6 +361,7 @@
'FailureMechanismEntityId' INTEGER NOT NULL,
'Name' TEXT,
'SegmentName' TEXT,
+ 'SegmentPoints' BLOB NOT NULL,
CONSTRAINT 'FK_StochasticSoilModelEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;
@@ -403,17 +401,6 @@
)
;
-CREATE TABLE 'StochasticSoilModelSegmentPointEntity'
-(
- 'StochasticSoilModelSegmentPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- 'StochasticSoilModelEntityId' INTEGER NOT NULL,
- 'X' REAL,
- 'Y' REAL,
- 'Order' INT (4) NOT NULL,
- CONSTRAINT 'FK_StochasticSoilModelSegmentPointEntity_StochasticSoilModelEntity' FOREIGN KEY ('StochasticSoilModelEntityId') REFERENCES 'StochasticSoilModelEntity' ('StochasticSoilModelEntityId') ON DELETE No Action ON UPDATE No Action
-)
-;
-
CREATE TABLE 'CharacteristicPointEntity'
(
'CharacteristicPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IRingtoetsEntities.cs
===================================================================
diff -u -r641deb71d80f4842345b3fce83304a00495010ed -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IRingtoetsEntities.cs (.../IRingtoetsEntities.cs) (revision 641deb71d80f4842345b3fce83304a00495010ed)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/IRingtoetsEntities.cs (.../IRingtoetsEntities.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -241,12 +241,6 @@
DbSet StochasticSoilModelEntities { get; }
///
- /// Gets a of
- /// containing every entity found in the database.
- ///
- DbSet StochasticSoilModelSegmentPointEntities { get; }
-
- ///
/// Gets a of containing
/// every entity found in the database.
///
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs
===================================================================
diff -u -r641deb71d80f4842345b3fce83304a00495010ed -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 641deb71d80f4842345b3fce83304a00495010ed)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.Context.cs (.../RingtoetsEntities.Context.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -86,7 +86,6 @@
public virtual DbSet SoilProfileEntities { get; set; }
public virtual DbSet StabilityStoneCoverSectionResultEntities { get; set; }
public virtual DbSet StochasticSoilModelEntities { get; set; }
- public virtual DbSet StochasticSoilModelSegmentPointEntities { get; set; }
public virtual DbSet StochasticSoilProfileEntities { get; set; }
public virtual DbSet StrengthStabilityLengthwiseConstructionSectionResultEntities { get; set; }
public virtual DbSet StrengthStabilityPointConstructionSectionResultEntities { get; set; }
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -394,17 +394,8 @@
+
-
-
-
-
-
-
-
-
-
-
@@ -958,18 +949,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1113,7 +1092,6 @@
-
@@ -1279,10 +1257,6 @@
-
-
-
-
@@ -1359,7 +1333,6 @@
-
@@ -1553,10 +1526,6 @@
-
-
-
-
@@ -2036,21 +2005,10 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2701,18 +2659,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -3160,24 +3106,14 @@
+
-
-
-
-
-
-
-
-
-
-
-
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -5,50 +5,49 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -95,7 +94,6 @@
-
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochasticSoilModelEntity.cs
===================================================================
diff -u -r1b46ad78fa9971fa15b74ca1e7904acf3483f24a -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochasticSoilModelEntity.cs (.../StochasticSoilModelEntity.cs) (revision 1b46ad78fa9971fa15b74ca1e7904acf3483f24a)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochasticSoilModelEntity.cs (.../StochasticSoilModelEntity.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -38,19 +38,17 @@
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public StochasticSoilModelEntity()
{
- this.StochasticSoilModelSegmentPointEntities = new HashSet();
this.StochasticSoilProfileEntities = new HashSet();
}
public long StochasticSoilModelEntityId { get; set; }
public long FailureMechanismEntityId { get; set; }
public string Name { get; set; }
public string SegmentName { get; set; }
+ public byte[] SegmentPoints { get; set; }
public virtual FailureMechanismEntity FailureMechanismEntity { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
- public virtual ICollection StochasticSoilModelSegmentPointEntities { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection StochasticSoilProfileEntities { get; set; }
}
}
Fisheye: Tag 23766b602d9b509a2ffc030f284e8d5e82325a3e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/StochasticSoilModelSegmentPointEntity.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs
===================================================================
diff -u -ra5714fc0488030773fff50dfc82041c6cb9edc2f -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs (.../StochasticSoilModelEntityReadExtensions.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelEntityReadExtensions.cs (.../StochasticSoilModelEntityReadExtensions.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -20,8 +20,8 @@
// All rights reserved.
using System;
-using System.Linq;
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.DbContext;
using Ringtoets.Piping.Data;
@@ -74,9 +74,7 @@
private static void ReadSegmentPoints(this StochasticSoilModelEntity entity, StochasticSoilModel model)
{
- model.Geometry.AddRange(entity.StochasticSoilModelSegmentPointEntities
- .OrderBy(pe => pe.Order)
- .Select(pe => pe.Read()));
+ model.Geometry.AddRange(new Point2DBinaryConverter().ToData(entity.SegmentPoints));
}
}
}
\ No newline at end of file
Fisheye: Tag 23766b602d9b509a2ffc030f284e8d5e82325a3e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilModelUpdateExtensions.cs
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilModelUpdateExtensions.cs (.../StochasticSoilModelUpdateExtensions.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/Piping/StochasticSoilModelUpdateExtensions.cs (.../StochasticSoilModelUpdateExtensions.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -20,16 +20,13 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
-using System.Linq;
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.Create;
using Application.Ringtoets.Storage.Create.Piping;
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Exceptions;
-using Core.Common.Base.Geometry;
-
using Ringtoets.Piping.Data;
namespace Application.Ringtoets.Storage.Update.Piping
@@ -94,40 +91,7 @@
private static void UpdateSoilModelSegment(StochasticSoilModel model, StochasticSoilModelEntity entity)
{
- if (HasChanges(entity.StochasticSoilModelSegmentPointEntities, model.Geometry))
- {
- entity.StochasticSoilModelSegmentPointEntities.Clear();
- UpdateSegmentPoints(model, entity);
- }
+ entity.SegmentPoints = new Point2DBinaryConverter().ToBytes(model.Geometry);
}
-
- private static bool HasChanges(ICollection existingPointEntities, List geometry)
- {
- StochasticSoilModelSegmentPointEntity[] existingPoints = existingPointEntities.OrderBy(pe => pe.Order).ToArray();
- if (existingPoints.Length != geometry.Count)
- {
- return true;
- }
- for (int i = 0; i < existingPoints.Length; i++)
- {
- Point2D existingPoint = new Point2D(existingPoints[i].X.ToNullAsNaN(),
- existingPoints[i].Y.ToNullAsNaN());
- if (!Math2D.AreEqualPoints(existingPoint, geometry[i]))
- {
- return true;
- }
- }
- return false;
- }
-
- private static void UpdateSegmentPoints(StochasticSoilModel model, StochasticSoilModelEntity entity)
- {
- for (int i = 0; i < model.Geometry.Count; i++)
- {
- Point2D point = model.Geometry[i];
- StochasticSoilModelSegmentPointEntity pointEntity = point.CreateStochasticSoilModelSegmentPointEntity(i);
- entity.StochasticSoilModelSegmentPointEntities.Add(pointEntity);
- }
- }
}
}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -167,7 +167,6 @@
-
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilModelCreateExtensionsTest.cs
===================================================================
diff -u -r01ff2c58c13df8f42661ae3e446dc2caaa94247e -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilModelCreateExtensionsTest.cs (.../StochasticSoilModelCreateExtensionsTest.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilModelCreateExtensionsTest.cs (.../StochasticSoilModelCreateExtensionsTest.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -21,6 +21,7 @@
using System;
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.Create;
using Application.Ringtoets.Storage.Create.Piping;
using Application.Ringtoets.Storage.DbContext;
@@ -112,7 +113,8 @@
// Assert
Assert.IsNotNull(entity);
- Assert.AreEqual(2, entity.StochasticSoilModelSegmentPointEntities.Count);
+ var expectedBinaryData = new Point2DBinaryConverter().ToBytes(stochasticSoilModel.Geometry);
+ CollectionAssert.AreEqual(expectedBinaryData, entity.SegmentPoints);
}
[Test]
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Point2DCreateExtensionsTest.cs
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Point2DCreateExtensionsTest.cs (.../Point2DCreateExtensionsTest.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Point2DCreateExtensionsTest.cs (.../Point2DCreateExtensionsTest.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -74,30 +74,5 @@
Assert.AreEqual(y, entity.Y);
Assert.AreEqual(order, entity.Order);
}
-
- [Test]
- [TestCase(0)]
- [TestCase(100)]
- [TestCase(Int32.MaxValue)]
- [TestCase(Int32.MinValue)]
- public void CreateStochasticSoilModelSegmentPointEntity_Always_NewStochasticSoilModelSegmentPointEntityWithPropertiesSet(int order)
- {
- // Setup
- var random = new Random(21);
- double x = random.NextDouble();
- double y = random.NextDouble();
- var point = new Point2D(x, y);
-
- // Call
- StochasticSoilModelSegmentPointEntity entity = point.CreateStochasticSoilModelSegmentPointEntity(order);
-
- // Assert
- Assert.AreEqual(x, entity.X);
- Assert.AreEqual(y, entity.Y);
- Assert.AreEqual(order, entity.Order);
-
- Assert.AreEqual(0, entity.StochasticSoilModelSegmentPointEntityId);
- Assert.AreEqual(0, entity.StochasticSoilModelEntityId);
- }
}
}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -22,8 +22,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
+
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Read;
+
+using Core.Common.Base.Geometry;
+
using NUnit.Framework;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
@@ -201,6 +206,7 @@
var entity = CreateAssessmentSectionEntity();
var entityId = new Random(21).Next(1, 502);
+ byte[] emptySegmentPointsData = new Point2DBinaryConverter().ToBytes(new Point2D[0]);
var failureMechanismEntity = new FailureMechanismEntity
{
FailureMechanismEntityId = entityId,
@@ -212,8 +218,14 @@
IsRelevant = Convert.ToByte(isRelevant),
StochasticSoilModelEntities =
{
- new StochasticSoilModelEntity(),
- new StochasticSoilModelEntity()
+ new StochasticSoilModelEntity
+ {
+ SegmentPoints = emptySegmentPointsData
+ },
+ new StochasticSoilModelEntity
+ {
+ SegmentPoints = emptySegmentPointsData
+ }
}
};
entity.FailureMechanismEntities.Add(failureMechanismEntity);
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -118,6 +118,7 @@
public void ReadAsPipingFailureMechanism_WithStochasticSoilModelsSet_ReturnsNewPipingFailureMechanismWithStochasticSoilModelsSet()
{
// Setup
+ byte[] emptySegmentPointsData = new Point2DBinaryConverter().ToBytes(new Point2D[0]);
var entity = new FailureMechanismEntity
{
CalculationGroupEntity = new CalculationGroupEntity
@@ -126,8 +127,14 @@
},
StochasticSoilModelEntities =
{
- new StochasticSoilModelEntity(),
- new StochasticSoilModelEntity()
+ new StochasticSoilModelEntity
+ {
+ SegmentPoints = emptySegmentPointsData
+ },
+ new StochasticSoilModelEntity
+ {
+ SegmentPoints = emptySegmentPointsData
+ }
}
};
var collector = new ReadConversionCollector();
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs (.../PipingCalculationEntityReadExtensionsTest.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs (.../PipingCalculationEntityReadExtensionsTest.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -21,6 +21,7 @@
using System;
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Read;
using Application.Ringtoets.Storage.Read.Piping;
@@ -333,6 +334,7 @@
var stochasticSoilModelEntity = new StochasticSoilModelEntity
{
StochasticSoilModelEntityId = 75,
+ SegmentPoints = new Point2DBinaryConverter().ToBytes(new Point2D[0]),
StochasticSoilProfileEntities =
{
stochasticSoilProfileEntity
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs
===================================================================
diff -u -ra5714fc0488030773fff50dfc82041c6cb9edc2f -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision a5714fc0488030773fff50dfc82041c6cb9edc2f)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelEntityReadExtensionsTest.cs (.../StochasticSoilModelEntityReadExtensionsTest.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -21,10 +21,13 @@
using System;
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Read;
using Application.Ringtoets.Storage.Read.Piping;
+using Core.Common.Base.Geometry;
+
using NUnit.Framework;
using Ringtoets.Piping.Data;
@@ -60,6 +63,7 @@
StochasticSoilModelEntityId = entityId,
Name = testName,
SegmentName = testSegmentName,
+ SegmentPoints = new Point2DBinaryConverter().ToBytes(new Point2D[0])
};
var collector = new ReadConversionCollector();
@@ -79,6 +83,7 @@
// Setup
var entity = new StochasticSoilModelEntity
{
+ SegmentPoints = new Point2DBinaryConverter().ToBytes(new Point2D[0]),
StochasticSoilProfileEntities =
{
new StochasticSoilProfileEntity
@@ -116,28 +121,33 @@
public void Read_WithCollectorWithStochasticSoilModelSegmentPointEntity_ReturnsNewStochasticSoilModelWithGeometryPoints()
{
// Setup
+ var segmentPoints = new[]
+ {
+ new Point2D(1, 2),
+ new Point2D(3, 4)
+ };
+
var entity = new StochasticSoilModelEntity
{
- StochasticSoilModelSegmentPointEntities =
- {
- new StochasticSoilModelSegmentPointEntity(),
- new StochasticSoilModelSegmentPointEntity()
- }
+ SegmentPoints = new Point2DBinaryConverter().ToBytes(segmentPoints)
};
var collector = new ReadConversionCollector();
// Call
var model = entity.Read(collector);
// Assert
- Assert.AreEqual(2, model.Geometry.Count);
+ CollectionAssert.AreEqual(segmentPoints, model.Geometry);
}
[Test]
public void Read_SameStochasticSoilModelEntityMultipleTimes_ReturnSameStochasticSoilModel()
{
// Setup
- var entity = new StochasticSoilModelEntity();
+ var entity = new StochasticSoilModelEntity
+ {
+ SegmentPoints = new Point2DBinaryConverter().ToBytes(new Point2D[0])
+ };
var collector = new ReadConversionCollector();
Fisheye: Tag 23766b602d9b509a2ffc030f284e8d5e82325a3e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilModelUpdateExtensionsTest.cs
===================================================================
diff -u -ra294987551b0b2d8a27b6e1bc6235b0e2351b6f4 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilModelUpdateExtensionsTest.cs (.../StochasticSoilModelUpdateExtensionsTest.cs) (revision a294987551b0b2d8a27b6e1bc6235b0e2351b6f4)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/StochasticSoilModelUpdateExtensionsTest.cs (.../StochasticSoilModelUpdateExtensionsTest.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -20,8 +20,8 @@
// All rights reserved.
using System;
-using System.Linq;
+using Application.Ringtoets.Storage.BinaryConverters;
using Application.Ringtoets.Storage.Create;
using Application.Ringtoets.Storage.DbContext;
using Application.Ringtoets.Storage.Exceptions;
@@ -270,43 +270,26 @@
new Point2D(3.3, 4.4)
});
- var originalPointEntity = new StochasticSoilModelSegmentPointEntity
+ var point2DBinaryConverter = new Point2DBinaryConverter();
+ var originalSegmentPointsData = point2DBinaryConverter.ToBytes(new[]
{
- StochasticSoilModelSegmentPointEntityId = 1,
- Order = 0,
- X = 5.5,
- Y = 6.6
- };
+ new Point2D(5.5, 6.6),
+ });
var soilModelEntity = new StochasticSoilModelEntity
{
StochasticSoilModelEntityId = soilModelId,
- StochasticSoilModelSegmentPointEntities =
- {
- originalPointEntity
- }
+ SegmentPoints = originalSegmentPointsData
};
context.StochasticSoilModelEntities.Add(soilModelEntity);
- context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity);
var registry = new PersistenceRegistry();
// Call
soilModel.Update(registry, context);
// Assert
- Assert.AreEqual(2, soilModelEntity.StochasticSoilModelSegmentPointEntities.Count);
+ CollectionAssert.AreEqual(point2DBinaryConverter.ToBytes(soilModel.Geometry), soilModelEntity.SegmentPoints);
- StochasticSoilModelSegmentPointEntity[] pointEntities = soilModelEntity.StochasticSoilModelSegmentPointEntities.ToArray();
- StochasticSoilModelSegmentPointEntity point1Entity = pointEntities[0];
- Assert.AreEqual(soilModel.Geometry[0].X, point1Entity.X);
- Assert.AreEqual(soilModel.Geometry[0].Y, point1Entity.Y);
- Assert.AreEqual(0, point1Entity.Order);
-
- StochasticSoilModelSegmentPointEntity point2Entity = pointEntities[1];
- Assert.AreEqual(soilModel.Geometry[1].X, point2Entity.X);
- Assert.AreEqual(soilModel.Geometry[1].Y, point2Entity.Y);
- Assert.AreEqual(1, point2Entity.Order);
-
mocks.VerifyAll();
}
@@ -329,52 +312,27 @@
new Point2D(3.3, 4.4)
});
- var originalPointEntity1 = new StochasticSoilModelSegmentPointEntity
+ var point2DBinaryConverter = new Point2DBinaryConverter();
+ var originalSegmentPointsData = point2DBinaryConverter.ToBytes(new[]
{
- StochasticSoilModelSegmentPointEntityId = 1,
- Order = 0,
- X = 5.5,
- Y = 6.6
- };
- var originalPointEntity2 = new StochasticSoilModelSegmentPointEntity
- {
- StochasticSoilModelSegmentPointEntityId = 2,
- Order = 1,
- X = 7.7,
- Y = 8.8
- };
+ new Point2D(5.5, 6.6),
+ new Point2D(7.7, 8.8)
+ });
var soilModelEntity = new StochasticSoilModelEntity
{
StochasticSoilModelEntityId = soilModelId,
- StochasticSoilModelSegmentPointEntities =
- {
- originalPointEntity1,
- originalPointEntity2
- }
+ SegmentPoints = originalSegmentPointsData
};
context.StochasticSoilModelEntities.Add(soilModelEntity);
- context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity1);
- context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity2);
var registry = new PersistenceRegistry();
// Call
soilModel.Update(registry, context);
// Assert
- Assert.AreEqual(2, soilModelEntity.StochasticSoilModelSegmentPointEntities.Count);
+ CollectionAssert.AreEqual(point2DBinaryConverter.ToBytes(soilModel.Geometry), soilModelEntity.SegmentPoints);
- StochasticSoilModelSegmentPointEntity[] pointEntities = soilModelEntity.StochasticSoilModelSegmentPointEntities.ToArray();
- StochasticSoilModelSegmentPointEntity point1Entity = pointEntities[0];
- Assert.AreEqual(soilModel.Geometry[0].X, point1Entity.X);
- Assert.AreEqual(soilModel.Geometry[0].Y, point1Entity.Y);
- Assert.AreEqual(0, point1Entity.Order);
-
- StochasticSoilModelSegmentPointEntity point2Entity = pointEntities[1];
- Assert.AreEqual(soilModel.Geometry[1].X, point2Entity.X);
- Assert.AreEqual(soilModel.Geometry[1].Y, point2Entity.Y);
- Assert.AreEqual(1, point2Entity.Order);
-
mocks.VerifyAll();
}
@@ -397,43 +355,21 @@
new Point2D(3.3, 4.4)
});
- var originalPointEntity1 = new StochasticSoilModelSegmentPointEntity
- {
- StochasticSoilModelSegmentPointEntityId = 1,
- Order = 0,
- X = soilModel.Geometry[0].X,
- Y = soilModel.Geometry[0].Y
- };
- var originalPointEntity2 = new StochasticSoilModelSegmentPointEntity
- {
- StochasticSoilModelSegmentPointEntityId = 2,
- Order = 1,
- X = soilModel.Geometry[1].X,
- Y = soilModel.Geometry[1].Y
- };
+ var originalSegmentPointData = new Point2DBinaryConverter().ToBytes(soilModel.Geometry);
var soilModelEntity = new StochasticSoilModelEntity
{
StochasticSoilModelEntityId = soilModelId,
- StochasticSoilModelSegmentPointEntities =
- {
- originalPointEntity1,
- originalPointEntity2
- }
+ SegmentPoints = originalSegmentPointData
};
context.StochasticSoilModelEntities.Add(soilModelEntity);
- context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity1);
- context.StochasticSoilModelSegmentPointEntities.Add(originalPointEntity2);
var registry = new PersistenceRegistry();
// Call
soilModel.Update(registry, context);
// Assert
- StochasticSoilModelSegmentPointEntity[] segmentPointEntities = context.StochasticSoilModelSegmentPointEntities.ToArray();
- CollectionAssert.Contains(segmentPointEntities, originalPointEntity1);
- CollectionAssert.Contains(segmentPointEntities, originalPointEntity2);
- Assert.AreEqual(2, segmentPointEntities.Length);
+ CollectionAssert.AreEqual(originalSegmentPointData, soilModelEntity.SegmentPoints);
mocks.VerifyAll();
}
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs
===================================================================
diff -u -ra20794746c723f3d02434953861bd3dc57800b73 -r23766b602d9b509a2ffc030f284e8d5e82325a3e
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision a20794746c723f3d02434953861bd3dc57800b73)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsEntitiesHelper.cs (.../RingtoetsEntitiesHelper.cs) (revision 23766b602d9b509a2ffc030f284e8d5e82325a3e)
@@ -70,7 +70,6 @@
DbSet pipingCalculationsOutputsSet = CreateEmptyTestDbSet();
DbSet pipingSemiProbabilisticOutputsSet = CreateEmptyTestDbSet();
DbSet stochasticSoilModelsSet = CreateEmptyTestDbSet();
- DbSet soilModelSegmentPointsSet = CreateEmptyTestDbSet();
DbSet stochasticSoilProfilesSet = CreateEmptyTestDbSet();
DbSet soilProfilesSet = CreateEmptyTestDbSet();
DbSet soilLayersSet = CreateEmptyTestDbSet();
@@ -115,7 +114,6 @@
ringtoetsEntities.Stub(r => r.PipingCalculationOutputEntities).Return(pipingCalculationsOutputsSet);
ringtoetsEntities.Stub(r => r.PipingSemiProbabilisticOutputEntities).Return(pipingSemiProbabilisticOutputsSet);
ringtoetsEntities.Stub(r => r.StochasticSoilModelEntities).Return(stochasticSoilModelsSet);
- ringtoetsEntities.Stub(r => r.StochasticSoilModelSegmentPointEntities).Return(soilModelSegmentPointsSet);
ringtoetsEntities.Stub(r => r.StochasticSoilProfileEntities).Return(stochasticSoilProfilesSet);
ringtoetsEntities.Stub(r => r.SoilProfileEntities).Return(soilProfilesSet);
ringtoetsEntities.Stub(r => r.SoilLayerEntities).Return(soilLayersSet);