Fix MongoDB class map hierarchy for inherited Content property
This commit is contained in:
+2
-3
@@ -31,6 +31,7 @@ public static class MongoDbMapConfigurator
|
||||
cm.MapField("_deletedFor").SetElementName("DeletedFor");
|
||||
cm.MapField("_readBy").SetElementName("ReadBy");
|
||||
cm.MapField("_reactions").SetElementName("Reactions");
|
||||
cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer());
|
||||
cm.MapProperty(c => c.Quote).SetSerializer(new EncryptedStringSerializer());
|
||||
cm.SetIsRootClass(true);
|
||||
});
|
||||
@@ -39,7 +40,6 @@ public static class MongoDbMapConfigurator
|
||||
{
|
||||
cm.AutoMap();
|
||||
cm.SetDiscriminator("TextMessage");
|
||||
cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer());
|
||||
});
|
||||
|
||||
BsonClassMap.RegisterClassMap<MediaMessage>(cm =>
|
||||
@@ -47,14 +47,13 @@ public static class MongoDbMapConfigurator
|
||||
cm.AutoMap();
|
||||
cm.MapField("_media").SetElementName("Media");
|
||||
cm.SetDiscriminator("MediaMessage");
|
||||
cm.MapProperty(c => c.Caption).SetSerializer(new EncryptedStringSerializer());
|
||||
cm.UnmapProperty(c => c.Caption); // Avoid DB duplication, Content is already saved
|
||||
});
|
||||
|
||||
BsonClassMap.RegisterClassMap<StoryMessage>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
cm.SetDiscriminator("StoryMessage");
|
||||
cm.MapProperty(c => c.Content).SetSerializer(new EncryptedStringSerializer());
|
||||
cm.MapProperty(c => c.InternalStoryMediaUrl).SetSerializer(new EncryptedStringSerializer());
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user