Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using adas_core.Domain.Enums;
|
||||
using adas_core.Domain.Models.MongoModels;
|
||||
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
|
||||
namespace adas_core.Infrastructure.Utils.MongoMaps;
|
||||
|
||||
public class DisplayHomeConfigContributor : IEntityMapContributor
|
||||
{
|
||||
public void RegisterMaps()
|
||||
{
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(CardConfig)))
|
||||
BsonClassMap.RegisterClassMap<CardConfig>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
cm.MapIdMember(c => c.Id).SetElementName("_id");
|
||||
cm.MapMember(c => c.Rows).SetDefaultValue(new List<RowCardConfig>());
|
||||
});
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(RowCardConfig)))
|
||||
BsonClassMap.RegisterClassMap<RowCardConfig>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
cm.MapMember(c => c.Cells).SetDefaultValue(new List<Cell>());
|
||||
cm.MapMember(c => c.GrowPriority).SetDefaultValue(1);
|
||||
cm.MapMember(c => c.Border).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.BorderRadius).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Size).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.MarginTop).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.MarginBottom).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.MarginLeft).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.MarginRight).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.BgColor).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.PaddingTop).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.PaddingBottom).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.PaddingLeft).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.PaddingRight).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Type)
|
||||
.SetDefaultValue(DisplayConfigEnums.CellType.Default)
|
||||
.SetSerializer(new EnumSerializer<DisplayConfigEnums.CellType>(BsonType.String));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user