Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundDataCreateExtensions.cs
===================================================================
diff -u -r258acae55e0ae70bcc094a2f7a577b7fbc8d8f2e -r40793165416093e9d2fefb6b12acf82fbd8a84c2
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundDataCreateExtensions.cs (.../BackgroundDataCreateExtensions.cs) (revision 258acae55e0ae70bcc094a2f7a577b7fbc8d8f2e)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/BackgroundDataCreateExtensions.cs (.../BackgroundDataCreateExtensions.cs) (revision 40793165416093e9d2fefb6b12acf82fbd8a84c2)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using Application.Ringtoets.Storage.DbContext;
using Core.Common.Utils.Extensions;
using Ringtoets.Common.Data.AssessmentSection;
@@ -28,17 +29,17 @@
{
///
/// Extensions methods for related to
- /// creating a .
+ /// creating a .
///
internal static class BackgroundDataCreateExtensions
{
///
- /// Creates a based on the information of the
+ /// Creates a based on the information of the
/// .
///
- /// The container to create a for.
+ /// The container to create a for.
/// The entity, or null if is not supported.
- internal static BackgroundMapDataEntity Create(this BackgroundData backgroundData)
+ internal static BackgroundDataEntity Create(this BackgroundData backgroundData)
{
if (backgroundData == null)
{
@@ -52,9 +53,9 @@
return null; // TODO: WTI-1141
}
- private static BackgroundMapDataEntity CreateWithWmtsData(BackgroundData backgroundData)
+ private static BackgroundDataEntity CreateWithWmtsData(BackgroundData backgroundData)
{
- var entity = new BackgroundMapDataEntity
+ var entity = new BackgroundDataEntity
{
Name = backgroundData.Name.DeepClone(),
IsVisible = Convert.ToByte(backgroundData.IsVisible),
@@ -63,12 +64,24 @@
if (backgroundData.IsConfigured)
{
- entity.SelectedCapabilityName = backgroundData.Parameters[BackgroundDataIdentifiers.SelectedCapabilityIdentifier].DeepClone();
- entity.SourceCapabilitiesUrl = backgroundData.Parameters[BackgroundDataIdentifiers.SourceCapabilitiesUrl].DeepClone();
- entity.PreferredFormat = backgroundData.Parameters[BackgroundDataIdentifiers.PreferredFormat].DeepClone();
+ AddEntitiesForBackgroundDataMeta(backgroundData, entity);
}
return entity;
}
+
+ private static void AddEntitiesForBackgroundDataMeta(BackgroundData backgroundData, BackgroundDataEntity entity)
+ {
+ foreach (KeyValuePair backgroundDataParameter in backgroundData.Parameters)
+ {
+ var metaEntity = new BackgroundDataMetaEntity
+ {
+ Key = backgroundDataParameter.Key.DeepClone(),
+ Value = backgroundDataParameter.Value.DeepClone()
+ };
+
+ entity.BackgroundDataMetaEntities.Add(metaEntity);
+ }
+ }
}
}
\ No newline at end of file