Describe the bug
If id is ulong, then an error is thrown.
LiteDB.LiteException: "Failed to create instance for type ..... Checks if the class has a public constructor with no parameters.
Code to Reproduce
public class SimpleMessage
{
[BsonId(false)]
public ulong Id { get; set; }
public string Content { get; set; }
[BsonCtor]
public SimpleMessage(ulong id, string content)
{
Id = id;
Content = content;
}
}
public void SaveAndLoadModel()
{
using (var db = new LiteDatabase("model.ldb", new BsonMapper().UseCamelCase()))
{
var simpleMsgs = db.GetCollection<SimpleMessage>();
try
{
var msg = new SimpleMessage(1174798982187391628, "Test message");
Console.WriteLine($"Database Msg: {msg.Id}, content: {msg.Content}");
simpleMsgs.Insert(msg);
var elements = simpleMsgs.FindAll();
foreach (var el in elements)
{
Console.WriteLine($"Database MsgId: {el.Id}, content: {el.Content}");
}
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}
}
Version 5.0.17 Windows 10 22H2 .NET 8.0
Describe the bug If id is ulong, then an error is thrown. LiteDB.LiteException: "Failed to create instance for type ..... Checks if the class has a public constructor with no parameters.
Code to Reproduce