surrealdb / surrealdb.net

SurrealDB SDK for .NET
https://surrealdb.com
Apache License 2.0
86 stars 16 forks source link

Add Support For Polymorphic Deserialization #79

Closed ronnieoverby closed 7 months ago

ronnieoverby commented 7 months ago

I encountered an exception trying to save an object instance with a property type that was abstract. A major improvement would be for this client library to allow saving / loading types that are derived from other types.

Odonno commented 7 months ago

Hello Ronnie,

The .NET SDK is using the System.Text.Json library. It should be familiar to every developer. If you serialize/deserialize to concrete type, I assume it should work as expected.

Can you share a reproduction example of your problem?

Note: You can add custom JsonConverter by setting configureJsonSerializerOptions argument if you want to handle custom type (de)serialization.

https://github.com/surrealdb/surrealdb.net/blob/2b25d6d3267e1cbd062bdc666daa537f63601cf1/SurrealDb.Net/Extensions/DependencyInjection/ServiceCollectionExtensions.cs#L38

ronnieoverby commented 7 months ago

That helps. Thanks.