Title: Add Support for LiteDB Serialization/Deserialization
Body:
Hi,
I’d like to request support for serializing and deserializing Primitively value types with LiteDB. Currently, when attempting to use Primitively types (e.g., custom int-based value types) with LiteDB, I encounter the following error intermittently:
Method may only be called on a Type for which Type.IsGenericParameter is true.
Steps to Reproduce
- Define a Primitively value type, e.g.,
public readonly partial struct CustomerId : int {}.
- Use it in an entity class, e.g.,
public class MyEntity { public CustomerId Id { get; set; } }.
- Attempt to insert and retrieve the entity using LiteDB (v5.x) with the default
BsonMapper.
Expected Behavior
LiteDB should serialize/deserialize the Primitively value type to/from its underlying primitive value (e.g., int) seamlessly.
Actual Behavior
Serialization/deserialization fails with the above error, likely due to LiteDB’s BsonMapper not recognizing Primitively types natively. It might be serializing the whole CustomerId vs the internal Value.
It would be great if Primitively could provide built-in support or documentation for LiteDB integration to avoid manual converter registration for each type.
Thanks!
Title: Add Support for LiteDB Serialization/Deserialization
Body:
Hi,
I’d like to request support for serializing and deserializing Primitively value types with LiteDB. Currently, when attempting to use Primitively types (e.g., custom
int-based value types) with LiteDB, I encounter the following error intermittently:Steps to Reproduce
public readonly partial struct CustomerId : int {}.public class MyEntity { public CustomerId Id { get; set; } }.BsonMapper.Expected Behavior
LiteDB should serialize/deserialize the Primitively value type to/from its underlying primitive value (e.g.,
int) seamlessly.Actual Behavior
Serialization/deserialization fails with the above error, likely due to LiteDB’s
BsonMappernot recognizing Primitively types natively. It might be serializing the whole CustomerId vs the internal Value.It would be great if Primitively could provide built-in support or documentation for LiteDB integration to avoid manual converter registration for each type.
Thanks!