LiteDB
LiteDB copied to clipboard
How to insert dynamic ExpandoObject List
How to insert dynamic / ExpendoObject to LiteDb. The BsonMapper throw an Null exception
Object reference not set to an instance of an object.
dynamic myObj = new ExpandoObject();
myObj.Test = "Yes";
myObj.Value = 123;
List<dynamic> list = new List<dynamic>();
list.Add(myObj);
var dynamicList = list.Select(s => BsonMapper.Global.ToDocument(s)).ToList();
BulkInsertToLite(dynamicList);
@mbdavid Does dynamic types supported in v5 ?
@vickyrathee dynamic
variables should work fine with LiteDB v5. The mapper uses reflection to detect the runtime type of the object.
@lbnascimento Any example in docs or tests I can refer?
It does not work with LiteDB v 5.0.10
It casts the same exception on Insert method: Null exception Object reference not set to an instance of an object.
I am also experiencing the same issue. When I insert some dynamic values they are null
Any updates on this topic? 5.0.11 seems to throw the same error.