Description
openedon Jun 21, 2022
We are continuously addressing and improving the SDK, if possible, make sure the problem persist in the latest SDK version.
Describe the bug
The options exposed for the built-in serializer are limited only to changing the name. Additional changes requires a custom serializer. However, any modifications in the custom serializer are not used when performing a query, making the option mostly useless.
To Reproduce
- Implement a custom serializer using example code.
- Store data
- Try to query the data with expression or LINQ
Example data:
enum CustomerRole {
Customer,
Manager
}
record Customer(string Id, string Name, CustomerRole Role);
var results = (await _container.GetItemLinqQueryable<Customer>().Where(x => x.Role == CustomerRole.Customer)).ToList();
Generated document (with custom serializer):
{
"name": "John Doe"
"role": "Customer",
"id": "..."
}
Expected behavior
The generated SQL should follow the settings on the custom serializer, i.e.:
WHERE c.role == "Customer"
The results
variable should contain the customer element.
Actual behavior
The generated SQL follows the default serializer and returns wrong name and value, i.e.:
WHERE c.Role == 0
The results
variable is always empty.
Environment summary
SDK Version: 3.28
OS Version: any
Additional context
An additional problem is that when setting a default serializer as in the example, it is not possible to also set the SerializerOptions, so all queries will fail unless each instantiated query also has specific serializer options set. This happens in the linked example as well, because the naming convention is changed.
Metadata
Assignees
Type
Projects
Status
Done