diff --git a/LiteDB/Client/Mapper/BsonMapper.Serialize.cs b/LiteDB/Client/Mapper/BsonMapper.Serialize.cs index ed26073b6..337890c8c 100644 --- a/LiteDB/Client/Mapper/BsonMapper.Serialize.cs +++ b/LiteDB/Client/Mapper/BsonMapper.Serialize.cs @@ -176,9 +176,13 @@ private BsonDocument SerializeDictionary(Type type, IDictionary dict, int depth) return o; } + //some settings + bool _useInterface=true; + private BsonDocument SerializeObject(Type type, object obj, int depth) { - var t = obj.GetType(); + //var t = obj.GetType(); + var t = _useInterface ? type : obj.GetType(); var doc = new BsonDocument(); var entity = this.GetEntityMapper(t); @@ -209,4 +213,4 @@ private BsonDocument SerializeObject(Type type, object obj, int depth) return doc; } } -} \ No newline at end of file +}