Hi folks!
I'm trying out RavenDB.Client 4.0 RC and one of the things I've noticed is that the sort order of the properties of the serialized json is different than in previous versions.
Given this class:
public class MyEntity
{
public string Username { get; set; }
public string Password { get; set; }
public string OrganizationId { get; set; }
public string AgentDutyCode { get; set; }
}
in 3.5 the document was serialized by the client with the properties in the same sort order as in the C# class definition.
{
"Username": "user",
"Password": "pass",
"OrganizationId": "data",
"AgentDutyCode": "data",
}
Now in Raven.Client 4.0 RC the json data gets posted to RavenDB with the properties sorted in alphabetical order.
{
"AgentDutyCode": "data",
"OrganizationId": "data",
"Password": "pass",
"Username": "user",
}
It's of course not a breaking change and it seems reasonable not to rely on json property ordering. However, given that a lot of work from a production system falls in the devops category I would guess that it makes sense to keep the same sort order as in the class definition. We tend to design entities with some ordering/grouping of properties in mind that is visually appealing for the person that has to open or edit a document in Studio and I think the client should respect that sorting decision that we make in the C# code.
I have tried to configure the Conventions through CustomizeJsonSerializerSettings and ContractResolver but with no luck.
Anybody knows how to revert to the previous behaviour?
Thanks!!!
Germán.