开发者

define a global custom serializer for a genericc type in RavenDB

开发者 https://www.devze.com 2023-03-30 08:03 出处:网络
Hi I\'m trying to use RavenDB to serialize F# collections. This is no problem as long as you stick to the normal .net collections.

Hi I'm trying to use RavenDB to serialize F# collections. This is no problem as long as you stick to the normal .net collections. But I want to serialize F#-Lists, Tuples and maybe even Sets too.

Now as I understand it, I could decorate my F#-objects with some attributes t开发者_如何学JAVAo hook up some Json.net functionality (but I don't exactly know how too).

But I had hoped that there is a way to tell RavenDB to serialize - lets say all List<'a> in a certain way (to be exact - just handle them as a IEnumerable/Seq and use List.ofSeq in the constructor)

Is this possible and if yes can you explain exactly how?


You can modify the serializer by providing your own JsonConverter class, and registering that with the RavenDB serializer by providing a lambda for Conventions.CustomizeSerializer function.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号