Custom CosmosSerializer and use GetItemLinqQueryable #321
Unanswered
mateuszkumpf
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Yuck, that's unfortunate that it's not honoring your custom JSON serializer. I'll dig into this as soon as I am able and report back. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys,
I created my custom CosmosSerializer:
For JsonSerializerSettings I set ContactResolver as CamelCasePropertyNamesContractResolver().
In the end I override default serializer using AdditionalSetupAction in AddCosmosRepository() like that
What is my problem? I can't use every place where the repository uses GetItemLinqQueryable() (e.g. GetAsync() with expression), because it builds the database query using the field names in the class as they are stored (in the PascalCase policy). The only fields I can use are those that have a JsonProperty attribute and a filled PropertyName or there camelCase policy selected.
Since I used my own serialiser (I needed more options which CosmosSerialisationOptions does not contain) I am forced to create SQL queries myself and use GetByQueryAsync() which, with modifications to the classes, is quite difficult to maintain.
I would ask for some advice.
Regards,
Mateusz Kumpf
Beta Was this translation helpful? Give feedback.
All reactions