Files

45 lines
2.4 KiB
C#

using adas_core.Domain.Models.MongoModels;
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
using MongoDB.Bson.Serialization;
namespace adas_core.Infrastructure.Utils.MongoMaps;
public class StandardMapContributor : IEntityMapContributor
{
public void RegisterMaps()
{
if (!BsonClassMap.IsClassMapRegistered(typeof(HistoricalConfigChanges)))
BsonClassMap.RegisterClassMap<HistoricalConfigChanges>(cm =>
{
cm.AutoMap();
//cm.MapMember(c => c.Id)
// .SetSerializer(new ObjectIdSerializer(BsonType.String));
//cm.GetMemberMap(c => c.ConfigType)
// .SetSerializer(new NullableSerializer<ConfigTypes>(new EnumSerializer<ConfigTypes>(BsonType.String)));
});
if (!BsonClassMap.IsClassMapRegistered(typeof(UiFontData)))
BsonClassMap.RegisterClassMap<UiFontData>(cm =>
{
cm.AutoMap();
cm.MapMember(c => c.WidthStepBed).SetIgnoreIfNull(true);
cm.MapMember(c => c.HeightStepBed).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeMediumValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeHeaderValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeLittleValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeMicroValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeNanoValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeLittleTextValue).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeName).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeLittleName).SetIgnoreIfNull(true);
cm.MapMember(c => c.FontSizeUnit).SetIgnoreIfNull(true);
cm.MapMember(c => c.BorderColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.BackGroundColor).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginTop).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginBot).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginLeft).SetIgnoreIfNull(true);
cm.MapMember(c => c.BoxMarginRight).SetIgnoreIfNull(true);
});
}
}