About Enum serialization

62 views
Skip to first unread message

imgen

unread,
Sep 26, 2011, 4:36:46 AM9/26/11
to ravendb
In this link:
http://stackoverflow.com/questions/6776615/store-enum-as-integer-in-ravendb
discuss a solution to let RavenDB to store enum as integers instead of
strings.
But I see that DocumentStore.Conventions doesn't have a Converters
property
anymore. How could I achieve this with the newer version of RavenDB.
BTW,
I'm using the latest RavenDB Embedded nuget package.

Ayende Rahien

unread,
Sep 26, 2011, 4:42:47 AM9/26/11
to rav...@googlegroups.com
You should register to the Conventions.CustomizeJsonSerializer event, and remove the appropriate converter from the serializer.

imgen

unread,
Sep 26, 2011, 6:05:28 AM9/26/11
to ravendb
Thx. That is fast.

On Sep 26, 4:42 pm, Ayende Rahien <aye...@ayende.com> wrote:
> You should register to the Conventions.CustomizeJsonSerializer event, and
> remove the appropriate converter from the serializer.
>
>
>
> On Mon, Sep 26, 2011 at 11:36 AM, imgen <imge...@gmail.com> wrote:
> > In this link:
> >http://stackoverflow.com/questions/6776615/store-enum-as-integer-in-r...
> > discuss a solution to let RavenDB to store enum as integers instead of
> > strings.
> > But I see that DocumentStore.Conventions doesn't have a Converters
> > property
> > anymore. How could I achieve this with the newer version of RavenDB.
> > BTW,
> > I'm using the latest RavenDB Embedded nuget package.- Hide quoted text -
>
> - Show quoted text -

imgen

unread,
Sep 26, 2011, 6:19:49 AM9/26/11
to ravendb
I tried that. But it seems like that I can not find EnumJsonConverter
in anyway. My code looks like
_documentStore.Conventions.CustomizeJsonSerializer =
jsonSerializer =>
{
jsonSerializer.Converters.Remove(...);
};
But I search thru Newtonsoft.Json and Raven.Json and didn't find a
class named EnumJsonConverter.

On Sep 26, 4:42 pm, Ayende Rahien <aye...@ayende.com> wrote:
> You should register to the Conventions.CustomizeJsonSerializer event, and
> remove the appropriate converter from the serializer.
>
>
>
> On Mon, Sep 26, 2011 at 11:36 AM, imgen <imge...@gmail.com> wrote:
> > In this link:
> >http://stackoverflow.com/questions/6776615/store-enum-as-integer-in-r...
> > discuss a solution to let RavenDB to store enum as integers instead of
> > strings.
> > But I see that DocumentStore.Conventions doesn't have a Converters
> > property
> > anymore. How could I achieve this with the newer version of RavenDB.
> > BTW,

Ayende Rahien

unread,
Sep 26, 2011, 6:21:44 AM9/26/11
to rav...@googlegroups.com
JsonEnumConverter  in Raven.Abstractions.Json

imgen

unread,
Sep 26, 2011, 7:15:38 AM9/26/11
to ravendb
Thx. It's done.
> > > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages