Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundDataCreateExtensions.cs =================================================================== diff -u -r7f540fc512a6c291d69612b1d0b9241d42288aef -r8f2d3db3a37f2f2d112e947c5d4b8928f05c559c --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundDataCreateExtensions.cs (.../BackgroundDataCreateExtensions.cs) (revision 7f540fc512a6c291d69612b1d0b9241d42288aef) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundDataCreateExtensions.cs (.../BackgroundDataCreateExtensions.cs) (revision 8f2d3db3a37f2f2d112e947c5d4b8928f05c559c) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; using Core.Common.Utils.Extensions; using Ringtoets.Common.Data.AssessmentSection; @@ -63,71 +62,53 @@ var wmtsBackgroundDataConfiguration = backgroundData.Configuration as WmtsBackgroundDataConfiguration; var wellKnownBackgroundDataConfiguration = backgroundData.Configuration as WellKnownBackgroundDataConfiguration; - var metaEntities = new List(); if (wmtsBackgroundDataConfiguration != null) { entity.BackgroundDataType = Convert.ToByte(BackgroundMapDataType.Wmts); - metaEntities.AddRange(GetWmtsMetaEntities(wmtsBackgroundDataConfiguration)); + AddWmtsMetaEntities(wmtsBackgroundDataConfiguration, entity); } else if (wellKnownBackgroundDataConfiguration != null) { entity.BackgroundDataType = Convert.ToByte(BackgroundMapDataType.WellKnown); - metaEntities.AddRange(GetWellKnownTileSourceMetaEntities(wellKnownBackgroundDataConfiguration)); + AddWellKnownTileSourceMetaEntities(wellKnownBackgroundDataConfiguration, entity); } - - foreach (BackgroundDataMetaEntity backgroundDataMetaEntity in metaEntities) - { - entity.BackgroundDataMetaEntities.Add(backgroundDataMetaEntity); - } } - private static IEnumerable GetWellKnownTileSourceMetaEntities(WellKnownBackgroundDataConfiguration wellKnownConfiguration) + private static void AddWellKnownTileSourceMetaEntities(WellKnownBackgroundDataConfiguration wellKnownConfiguration, BackgroundDataEntity entity) { - return new[] + entity.BackgroundDataMetaEntities.Add(new BackgroundDataMetaEntity { - new BackgroundDataMetaEntity - { - Key = BackgroundDataIdentifiers.WellKnownTileSource.DeepClone(), - Value = ((int) wellKnownConfiguration.WellKnownTileSource).ToString().DeepClone() - } - }; + Key = BackgroundDataIdentifiers.WellKnownTileSource.DeepClone(), + Value = ((int) wellKnownConfiguration.WellKnownTileSource).ToString().DeepClone() + }); } - private static IEnumerable GetWmtsMetaEntities(WmtsBackgroundDataConfiguration wmtsBackgroundDataConfiguration) + private static void AddWmtsMetaEntities(WmtsBackgroundDataConfiguration wmtsBackgroundDataConfiguration, BackgroundDataEntity entity) { - var entities = new List + entity.BackgroundDataMetaEntities.Add(new BackgroundDataMetaEntity { - new BackgroundDataMetaEntity - { - Key = BackgroundDataIdentifiers.IsConfigured, - Value = Convert.ToByte(wmtsBackgroundDataConfiguration.IsConfigured).ToString() - } - }; + Key = BackgroundDataIdentifiers.IsConfigured, + Value = Convert.ToByte(wmtsBackgroundDataConfiguration.IsConfigured).ToString() + }); if (wmtsBackgroundDataConfiguration.IsConfigured) { - entities.AddRange( - new[] - { - new BackgroundDataMetaEntity - { - Key = BackgroundDataIdentifiers.SelectedCapabilityIdentifier.DeepClone(), - Value = wmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier.DeepClone() - }, - new BackgroundDataMetaEntity - { - Key = BackgroundDataIdentifiers.SourceCapabilitiesUrl.DeepClone(), - Value = wmtsBackgroundDataConfiguration.SourceCapabilitiesUrl.DeepClone() - }, - new BackgroundDataMetaEntity - { - Key = BackgroundDataIdentifiers.PreferredFormat.DeepClone(), - Value = wmtsBackgroundDataConfiguration.PreferredFormat.DeepClone() - } - }); + entity.BackgroundDataMetaEntities.Add(new BackgroundDataMetaEntity + { + Key = BackgroundDataIdentifiers.SelectedCapabilityIdentifier.DeepClone(), + Value = wmtsBackgroundDataConfiguration.SelectedCapabilityIdentifier.DeepClone() + }); + entity.BackgroundDataMetaEntities.Add(new BackgroundDataMetaEntity + { + Key = BackgroundDataIdentifiers.SourceCapabilitiesUrl.DeepClone(), + Value = wmtsBackgroundDataConfiguration.SourceCapabilitiesUrl.DeepClone() + }); + entity.BackgroundDataMetaEntities.Add(new BackgroundDataMetaEntity + { + Key = BackgroundDataIdentifiers.PreferredFormat.DeepClone(), + Value = wmtsBackgroundDataConfiguration.PreferredFormat.DeepClone() + }); } - - return entities; } } } \ No newline at end of file