Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r003c0b0d85b08cd50c56f29ec9539e973a5bd7c1 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 003c0b0d85b08cd50c56f29ec9539e973a5bd7c1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -53,6 +53,7 @@ + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs =================================================================== diff -u -rc2bf0666539fa1a781c6d5d633ac292fa4fe2bd4 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision c2bf0666539fa1a781c6d5d633ac292fa4fe2bd4) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -54,9 +54,10 @@ /// /// The section to create a database entity for. /// The object keeping track of create operations. + /// The index at which resides in its parent. /// A new . /// Thrown when is null. - internal static AssessmentSectionEntity Create(this AssessmentSection section, PersistenceRegistry registry) + internal static AssessmentSectionEntity Create(this AssessmentSection section, PersistenceRegistry registry, int order) { if (registry == null) { @@ -69,7 +70,8 @@ Name = section.Name.DeepClone(), Composition = (short) section.Composition, Comments = section.Comments.DeepClone(), - Norm = section.FailureMechanismContribution.Norm + Norm = section.FailureMechanismContribution.Norm, + Order = order }; AddEntityForHydraulicDatabase(section, entity, registry); Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/RingtoetsProjectCreateExtensions.cs =================================================================== diff -u -rc312034c7478db99d3c2ef96b1c351df806e8d21 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/RingtoetsProjectCreateExtensions.cs (.../RingtoetsProjectCreateExtensions.cs) (revision c312034c7478db99d3c2ef96b1c351df806e8d21) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/RingtoetsProjectCreateExtensions.cs (.../RingtoetsProjectCreateExtensions.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -57,9 +57,10 @@ private static void AddEntitiesForAssessmentSections(RingtoetsProject project, ProjectEntity entity, PersistenceRegistry registry) { - foreach (var result in project.AssessmentSections) + for (int index = 0; index < project.AssessmentSections.Count; index++) { - entity.AssessmentSectionEntities.Add(result.Create(registry)); + AssessmentSection assessmentSection = project.AssessmentSections[index]; + entity.AssessmentSectionEntities.Add(assessmentSection.Create(registry, index)); } } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/AssessmentSectionEntity.cs =================================================================== diff -u -raf81664b5c0cb1af94c61530adbb6cd24fd5229f -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/AssessmentSectionEntity.cs (.../AssessmentSectionEntity.cs) (revision af81664b5c0cb1af94c61530adbb6cd24fd5229f) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/AssessmentSectionEntity.cs (.../AssessmentSectionEntity.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -52,6 +52,7 @@ public string HydraulicDatabaseLocation { get; set; } public short Composition { get; set; } public string ReferenceLinePointXml { get; set; } + public int Order { get; set; } public virtual ProjectEntity ProjectEntity { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql =================================================================== diff -u -r003c0b0d85b08cd50c56f29ec9539e973a5bd7c1 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 003c0b0d85b08cd50c56f29ec9539e973a5bd7c1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/DatabaseStructure.sql (.../DatabaseStructure.sql) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -1,6 +1,6 @@ /* ---------------------------------------------------- */ /* Generated by Enterprise Architect Version 12.0 */ -/* Created On : 10-aug-2016 8:51:03 */ +/* Created On : 11-aug-2016 10:27:40 */ /* DBMS : SQLite */ /* ---------------------------------------------------- */ @@ -166,6 +166,7 @@ 'HydraulicDatabaseLocation' TEXT, 'Composition' SMALLINT NOT NULL, -- Enum: Dike = 0, Dune = 1, DikeAndDune = 2 'ReferenceLinePointXml' TEXT, + 'Order' INT (4) NOT NULL, CONSTRAINT 'FK_AssessmentSectionEntity_ProjectEntity' FOREIGN KEY ('ProjectEntityId') REFERENCES 'ProjectEntity' ('ProjectEntityId') ON DELETE Cascade ON UPDATE Cascade ) ; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx =================================================================== diff -u -r003c0b0d85b08cd50c56f29ec9539e973a5bd7c1 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 003c0b0d85b08cd50c56f29ec9539e973a5bd7c1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx (.../RingtoetsEntities.edmx) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -19,6 +19,7 @@ + @@ -1458,6 +1459,7 @@ + @@ -2534,6 +2536,7 @@ + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram =================================================================== diff -u -r003c0b0d85b08cd50c56f29ec9539e973a5bd7c1 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 003c0b0d85b08cd50c56f29ec9539e973a5bd7c1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/RingtoetsEntities.edmx.diagram (.../RingtoetsEntities.edmx.diagram) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -5,46 +5,46 @@ - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - + + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/FingerprintHelper.cs =================================================================== diff -u -rc2bf0666539fa1a781c6d5d633ac292fa4fe2bd4 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/FingerprintHelper.cs (.../FingerprintHelper.cs) (revision c2bf0666539fa1a781c6d5d633ac292fa4fe2bd4) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/FingerprintHelper.cs (.../FingerprintHelper.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -24,6 +24,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Security.Cryptography; +using System.ServiceModel; using System.Xml; using Application.Ringtoets.Storage.DbContext; @@ -40,6 +41,9 @@ /// /// The to generate a hashcode for. /// The binary hashcode for . + /// Thrown when is null. + /// Thrown when + /// contains more than unique object instances. public static byte[] Get(ProjectEntity entity) { if (entity == null) @@ -61,7 +65,7 @@ } /// - /// Determines if two fingerprint byte arrays are equal to eachother. + /// Determines if two fingerprint byte arrays are equal to each other. /// /// The first array, cannot be null. /// The second array, cannot be null. Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs =================================================================== diff -u -r003c0b0d85b08cd50c56f29ec9539e973a5bd7c1 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 003c0b0d85b08cd50c56f29ec9539e973a5bd7c1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -63,7 +63,7 @@ /// /// Looks up a localized string similar to /* ---------------------------------------------------- */ ////* Generated by Enterprise Architect Version 12.0 */ - ////* Created On : 10-aug-2016 8:51:03 */ + ////* Created On : 11-aug-2016 10:27:40 */ ////* DBMS : SQLite */ ////* ---------------------------------------------------- */ /// @@ -81,7 +81,7 @@ ///DROP TABLE IF EXISTS 'AssessmentSectionEntity' ///; /// - ///DROP TABLE IF EXISTS 'FailureMechanismSectionEntit [rest of string was truncated]";. + ///DROP TABLE IF EXISTS 'FailureMechanismSectionEnti [rest of string was truncated]";. /// internal static string DatabaseStructure { get { @@ -92,36 +92,27 @@ /// /// Looks up a localized string similar to Er is een fout opgetreden in de verbinding met het Ringtoets bestand.. /// - internal static string Error_During_Connection { + internal static string Error_during_connection { get { - return ResourceManager.GetString("Error_During_Connection", resourceCulture); + return ResourceManager.GetString("Error_during_connection", resourceCulture); } } /// - /// Looks up a localized string similar to Het object '{0}' met id '{1}' is niet gevonden.. + /// Looks up a localized string similar to Een fout is opgetreden tijdens het opslaan van het Ringtoets bestand.. /// - internal static string Error_Entity_Not_Found_0_1 { + internal static string Error_saving_database { get { - return ResourceManager.GetString("Error_Entity_Not_Found_0_1", resourceCulture); + return ResourceManager.GetString("Error_saving_database", resourceCulture); } } /// - /// Looks up a localized string similar to Een fout is opgetreden met het updaten van het Ringtoets bestand.. - /// - internal static string Error_Update_Database { - get { - return ResourceManager.GetString("Error_Update_Database", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Een fout is opgetreden met schrijven naar het nieuwe Ringtoets bestand.. /// - internal static string Error_Write_Structure_to_Database { + internal static string Error_writing_structure_to_database { get { - return ResourceManager.GetString("Error_Write_Structure_to_Database", resourceCulture); + return ResourceManager.GetString("Error_writing_structure_to_database", resourceCulture); } } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx =================================================================== diff -u -r003c0b0d85b08cd50c56f29ec9539e973a5bd7c1 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx (.../Resources.resx) (revision 003c0b0d85b08cd50c56f29ec9539e973a5bd7c1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Properties/Resources.resx (.../Resources.resx) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -121,16 +121,13 @@ ..\DbContext\DatabaseStructure.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - + Er is een fout opgetreden in de verbinding met het Ringtoets bestand. - - Het object '{0}' met id '{1}' is niet gevonden. + + Een fout is opgetreden tijdens het opslaan van het Ringtoets bestand. - - Een fout is opgetreden met het updaten van het Ringtoets bestand. - - + Een fout is opgetreden met schrijven naar het nieuwe Ringtoets bestand. Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ProjectEntityReadExtensions.cs =================================================================== diff -u -re2e6d944af7b0cea6c9c34e77bd0644149526c37 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ProjectEntityReadExtensions.cs (.../ProjectEntityReadExtensions.cs) (revision e2e6d944af7b0cea6c9c34e77bd0644149526c37) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ProjectEntityReadExtensions.cs (.../ProjectEntityReadExtensions.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Application.Ringtoets.Storage.DbContext; using Ringtoets.Integration.Data; @@ -50,7 +51,7 @@ Description = entity.Description }; - foreach (var assessmentSectionEntity in entity.AssessmentSectionEntities) + foreach (var assessmentSectionEntity in entity.AssessmentSectionEntities.OrderBy(ase => ase.Order)) { project.AssessmentSections.Add(assessmentSectionEntity.Read(collector)); } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/DataCollectionSerializer.cs =================================================================== diff -u -rc2bf0666539fa1a781c6d5d633ac292fa4fe2bd4 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/DataCollectionSerializer.cs (.../DataCollectionSerializer.cs) (revision c2bf0666539fa1a781c6d5d633ac292fa4fe2bd4) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/DataCollectionSerializer.cs (.../DataCollectionSerializer.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; +using System.ServiceModel; using System.Text; using System.Xml; @@ -41,6 +42,8 @@ /// Thrown when is null. /// Thrown when an I/O error occurs. /// Thrown when an error occurs during serialization. + /// Thrown when + /// contains too many objects. public string ToXml(IEnumerable elements) { if (elements == null) Index: Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqLite.cs =================================================================== diff -u -r003c0b0d85b08cd50c56f29ec9539e973a5bd7c1 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqLite.cs (.../StorageSqLite.cs) (revision 003c0b0d85b08cd50c56f29ec9539e973a5bd7c1) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqLite.cs (.../StorageSqLite.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -24,6 +24,7 @@ using System.Data.Entity; using System.IO; using System.Linq; +using System.ServiceModel; using Application.Ringtoets.Storage.Create; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; @@ -169,12 +170,19 @@ return true; } - using (var dbContext = new RingtoetsEntities(connectionString)) + try { - byte[] originalHash = dbContext.VersionEntities.Select(v => v.FingerPrint).First(); - byte[] hash = FingerprintHelper.Get(stagedProjectEntity); - return !FingerprintHelper.AreEqual(originalHash, hash); + using (var dbContext = new RingtoetsEntities(connectionString)) + { + byte[] originalHash = dbContext.VersionEntities.Select(v => v.FingerPrint).First(); + byte[] hash = FingerprintHelper.Get(stagedProjectEntity); + return !FingerprintHelper.AreEqual(originalHash, hash); + } } + catch (QuotaExceededException e) + { + throw new StorageException("Het project bevat te veel unieke objecten om een digitale vingerafdruk van te genereren.", e); + } } private void ValidateDatabaseVersion(RingtoetsEntities ringtoetsEntities, string databaseFilePath) @@ -226,13 +234,17 @@ } catch (DataException exception) { - throw CreateStorageWriterException(databaseFilePath, Resources.Error_Update_Database, exception); + throw CreateStorageWriterException(databaseFilePath, Resources.Error_saving_database, exception); } + catch (QuotaExceededException exception) + { + throw CreateStorageWriterException(databaseFilePath, exception.Message, exception); + } catch (SystemException exception) { if (exception is InvalidOperationException || exception is NotSupportedException) { - throw CreateStorageWriterException(databaseFilePath, Resources.Error_During_Connection, exception); + throw CreateStorageWriterException(databaseFilePath, Resources.Error_during_connection, exception); } throw; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqliteCreator.cs =================================================================== diff -u -r3456261423844a9f804b352472ac08feb22485ac -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqliteCreator.cs (.../StorageSqliteCreator.cs) (revision 3456261423844a9f804b352472ac08feb22485ac) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/StorageSqliteCreator.cs (.../StorageSqliteCreator.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -72,7 +72,7 @@ } catch (SQLiteException exception) { - var message = new FileWriterErrorMessageBuilder(databaseFilePath).Build(Resources.Error_Write_Structure_to_Database); + var message = new FileWriterErrorMessageBuilder(databaseFilePath).Build(Resources.Error_writing_structure_to_database); throw new StorageException(message, new UpdateStorageException("", exception)); } finally Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs =================================================================== diff -u -rc2bf0666539fa1a781c6d5d633ac292fa4fe2bd4 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs (.../AssessmentSectionCreateExtensionsTest.cs) (revision c2bf0666539fa1a781c6d5d633ac292fa4fe2bd4) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs (.../AssessmentSectionCreateExtensionsTest.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -45,7 +45,7 @@ var assessmentSection = new AssessmentSection(assessmentSectionComposition); // Call - TestDelegate test = () => assessmentSection.Create(null); + TestDelegate test = () => assessmentSection.Create(null, 0); // Assert var parameterName = Assert.Throws(test).ParamName; @@ -63,6 +63,7 @@ const string testName = "testName"; const string comments = "Some text"; const int norm = int.MaxValue; + int order = new Random(65).Next(); var assessmentSection = new AssessmentSection(assessmentSectionComposition) { Id = testId, @@ -76,7 +77,7 @@ var registry = new PersistenceRegistry(); // Call - var entity = assessmentSection.Create(registry); + var entity = assessmentSection.Create(registry, order); // Assert Assert.IsNotNull(entity); @@ -104,6 +105,7 @@ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.StrengthAndStabilityParallelConstruction)); Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.DuneErosion)); Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.TechnicalInnovations)); + Assert.AreEqual(order, entity.Order); Assert.IsNull(entity.HydraulicDatabaseLocation); Assert.IsNull(entity.HydraulicDatabaseVersion); @@ -128,7 +130,7 @@ var registry = new PersistenceRegistry(); // Call - AssessmentSectionEntity entity = section.Create(registry); + AssessmentSectionEntity entity = section.Create(registry, 0); // Assert Assert.AreNotSame(originalName, entity.Name, @@ -162,7 +164,7 @@ var registry = new PersistenceRegistry(); // Call - var entity = assessmentSection.Create(registry); + var entity = assessmentSection.Create(registry, 0); // Assert Assert.AreEqual(testFilePath, entity.HydraulicDatabaseLocation); @@ -190,7 +192,7 @@ var registry = new PersistenceRegistry(); // Call - var entity = assessmentSection.Create(registry); + var entity = assessmentSection.Create(registry, 0); // Assert string expectedXml = new Point2DXmlSerializer().ToXml(points); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ProjectEntityReadExtensionsTest.cs =================================================================== diff -u -re2e6d944af7b0cea6c9c34e77bd0644149526c37 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ProjectEntityReadExtensionsTest.cs (.../ProjectEntityReadExtensionsTest.cs) (revision e2e6d944af7b0cea6c9c34e77bd0644149526c37) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ProjectEntityReadExtensionsTest.cs (.../ProjectEntityReadExtensionsTest.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Read; using NUnit.Framework; @@ -76,11 +77,15 @@ { new AssessmentSectionEntity { - Norm = norm + Norm = norm, + Name = "A", + Order = 56 }, new AssessmentSectionEntity { - Norm = norm + Norm = norm, + Name = "B", + Order = 0 } } }; @@ -90,6 +95,10 @@ // Assert Assert.AreEqual(2, project.AssessmentSections.Count); + CollectionAssert.AreEqual(new[] + { + "B", "A" + }, project.AssessmentSections.Select(a => a.Name)); } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs =================================================================== diff -u -rce31448a066c084f755439f3e7d453bfb042b291 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision ce31448a066c084f755439f3e7d453bfb042b291) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/StorageSqLiteTest.cs (.../StorageSqLiteTest.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -385,9 +385,11 @@ var storage = new StorageSqLite(); storage.StageProject(project); - FileDisposeHelper fileDisposeHelper = new FileDisposeHelper(tempRingtoetsFile); try { + // Precondition + Assert.IsFalse(File.Exists(tempRingtoetsFile)); + // Call TestDelegate test = () => storage.SaveProjectAs(tempRingtoetsFile); @@ -397,7 +399,7 @@ finally { CallGarbageCollector(); - fileDisposeHelper.Dispose(); + File.Delete(tempRingtoetsFile); } } @@ -412,6 +414,9 @@ FileDisposeHelper fileDisposeHelper = new FileDisposeHelper(tempRingtoetsFile); try { + // Precondition + Assert.IsTrue(File.Exists(tempRingtoetsFile)); + // Call TestDelegate test = () => storage.SaveProjectAs(tempRingtoetsFile); Index: Core/Common/src/Core.Common.Base/Storage/IStoreProject.cs =================================================================== diff -u -rc2bf0666539fa1a781c6d5d633ac292fa4fe2bd4 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Core/Common/src/Core.Common.Base/Storage/IStoreProject.cs (.../IStoreProject.cs) (revision c2bf0666539fa1a781c6d5d633ac292fa4fe2bd4) +++ Core/Common/src/Core.Common.Base/Storage/IStoreProject.cs (.../IStoreProject.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -98,6 +98,8 @@ /// true if last was set and is different /// from the staged project, false otherwise. /// Thrown when no project has been staged. + /// Thrown when the staged project contains + /// more then unique object instances. bool HasStagedProjectChanges(); } } \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs =================================================================== diff -u -rce31448a066c084f755439f3e7d453bfb042b291 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision ce31448a066c084f755439f3e7d453bfb042b291) +++ Core/Common/src/Core.Common.Gui/Commands/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -65,10 +65,19 @@ return true; } projectPersistor.StageProject(project); - if (!projectPersistor.HasStagedProjectChanges()) + try { + if (!projectPersistor.HasStagedProjectChanges()) + { + projectPersistor.UnstageProject(); + return true; + } + } + catch (StorageException e) + { + log.Error(e.Message, e); projectPersistor.UnstageProject(); - return true; + return false; } var openSaveOrDiscardProjectDialog = OpenSaveOrDiscardProjectDialog(); Index: Core/Common/test/Core.Common.TestUtil/DirectoryPermissionsRevoker.cs =================================================================== diff -u -rc526a6a30198a0f81dd71d0f03e554ebe861f853 -r1d86c8daf73d71b72c7a105b5f564ae7480a8d7f --- Core/Common/test/Core.Common.TestUtil/DirectoryPermissionsRevoker.cs (.../DirectoryPermissionsRevoker.cs) (revision c526a6a30198a0f81dd71d0f03e554ebe861f853) +++ Core/Common/test/Core.Common.TestUtil/DirectoryPermissionsRevoker.cs (.../DirectoryPermissionsRevoker.cs) (revision 1d86c8daf73d71b72c7a105b5f564ae7480a8d7f) @@ -88,7 +88,8 @@ } SecurityIdentifier sid = GetSecurityIdentifier(); - var fileSystemAccessRule = new FileSystemAccessRule(sid, rights, AccessControlType.Deny); + var fileSystemAccessRule = new FileSystemAccessRule(sid, rights, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, + PropagationFlags.None, AccessControlType.Deny); directorySecurity.AddAccessRule(fileSystemAccessRule); directoryInfo.SetAccessControl(directorySecurity);