RavenDB can serialize all public, private and protected properties on any given C# object, even without any serialization attributes.
I know that this can be done with reflection, but that would have some performance issues. Are there other more efficient ways to achieve this?
To use the built-in serialization in .NET requires annotations or implementing some serialization interfaces, whereas RavenDB can serialize any given object to and from JSON.
I'm more interested in technology it uses and not RavenDB in specific.
If setting properties through reflection is too slow, you can generate dynamic methods that set them at runtime. This can be done using Relection.Emit
or by creating an compiling an Expression<T>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With