Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a way to change the objects are serialized CustomJsonSerializerSettings #56

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

jjchiw
Copy link
Contributor

@jjchiw jjchiw commented Oct 17, 2016

I had a problem with the way the the Date was serialized and saved in the database. I needed to be saved with the format ISO 8601....

So I added a function in DatabaseSharedSetting to change the JsonSerializerSettings

var setting = new DatabaseSharedSetting();
...
setting.CustomJsonSerializer = (db, converters) =>
{
    return JsonSerializer.Create(
        new JsonSerializerSettings
        {
            ContractResolver =  ArangoDB.Client.Serialization.DocumentContractResolver.GetContractResolver(db),
            Converters = converters,
            DateParseHandling = DateParseHandling.None,
            DateTimeZoneHandling = DateTimeZoneHandling.Utc
        });
};

@ra0o0f
Copy link
Owner

ra0o0f commented Oct 18, 2016

thanks again @jjchiw for making the driver better. i will look at these changes asap. but just one thing to say is that ArangoDB is using json binary serializer called VelocyPack and its being used in their official java client. Json.NET support will remain in the c# client but i will add support for VelocyPack in the future. so these settings may change in the future to work with both of them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants