Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelCollection.cs =================================================================== diff -u -r8eb717ca45b6518cccfef85e481e0da52ce1df4e -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelCollection.cs (.../StochasticSoilModelCollection.cs) (revision 8eb717ca45b6518cccfef85e481e0da52ce1df4e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelCollection.cs (.../StochasticSoilModelCollection.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -19,26 +19,19 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; -using System.Linq; using Core.Common.Base; namespace Ringtoets.Piping.Data { /// /// A collection of . /// - public class StochasticSoilModelCollection : ObservableCollectionWithSourcePath + public class StochasticSoilModelCollection : ObservableUniqueItemCollectionWithSourcePath { protected override void ValidateItems(IEnumerable items) { - IEnumerable> duplicates = items.GroupBy(m => m.Name).Where(g => g.Count() > 1); - if(duplicates.Any()) - { - var names = string.Join(", ", duplicates.Select(g => g.First())); - throw new ArgumentException($@"Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele namen: {names}."); - } + ValidateListOnDuplicateFeature(items, model => model.Name, "Ondergrondmodellen", "naam"); } } } \ No newline at end of file