Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using adas_core.Domain.Enums;
|
||||
using adas_core.Domain.Models.BsonConverters;
|
||||
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;
|
||||
using Stream = adas_core.Domain.Models.MongoModels.Stream;
|
||||
|
||||
|
||||
namespace adas_core.Infrastructure.Utils.MongoMaps;
|
||||
|
||||
public class BoxConfigMapContributor : IEntityMapContributor
|
||||
{
|
||||
public void RegisterMaps()
|
||||
{
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Box)))
|
||||
BsonClassMap.RegisterClassMap<Box>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
cm.UnmapMember(c => c.PointOfCare); //Esto hace que ignora la propiedad en la serialización del Bson
|
||||
cm.MapMember(c => c.Bed).SetElementName("name");
|
||||
cm.UnmapMember(c => c.IsActive);
|
||||
cm.UnmapMember(c => c.IsVisible);
|
||||
cm.MapMember(c => c.Configuration)
|
||||
.SetSerializer(new DictionaryBsonConverter())
|
||||
.SetIgnoreIfNull(true);
|
||||
cm.UnmapMember(c => c.Location);
|
||||
cm.UnmapMember(c => c.HasPatient);
|
||||
cm.UnmapMember(c => c.Patientid);
|
||||
cm.UnmapMember(c => c.Patient);
|
||||
cm.UnmapMember(c => c.AttendingDoctor);
|
||||
cm.UnmapMember(c => c.Type);
|
||||
cm.UnmapMember(c => c.Observations);
|
||||
cm.UnmapMember(c => c.Medication);
|
||||
});
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Sensor)))
|
||||
BsonClassMap.RegisterClassMap<Sensor>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
cm.MapMember(c => c.Name).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Title).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.OnlyNumbers).SetDefaultValue(true);
|
||||
cm.MapMember(c => c.IsGeneral).SetDefaultValue(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user