-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Cosmos provider builds/uses wrong model when keys have value converters #19638
Comments
Fixes #13507 See also #19638 and #19641 Basic logic is: * If model type implements some sort of IComparable, then use it * Otherwise, if provider type implement some sore of IComparable, then use it * Otherwise fail in model validation Also added new test suite specifically for different types of keys with and without conversions.
This is by design see https://docs.microsoft.com/en-us/ef/core/providers/cosmos/?tabs=dotnet-core-cli#working-with-disconnected-entities |
@AndriySvyryd The entities here are being Added and then saved, so the value should get generated.
How do key values get turned into strings? |
Fixes #13507 Fixes #19638 See also #19641 Basic logic is: * If model type implements some sort of IComparable, then use it * Otherwise, if provider type implement some sore of IComparable, then use it * Otherwise fail in model validation Also added new test suite specifically for different types of keys with and without conversions.
Fixed issue by using provider values to generate the strings. These are much more likely to generate sane values when converted to strings. |
Fixes #13507 Fixes #19638 See also #19641 Basic logic is: * If model type implements some sort of IComparable, then use it * Otherwise, if provider type implement some sore of IComparable, then use it * Otherwise fail in model validation Also added new test suite specifically for different types of keys with and without conversions.
Fixes #13507 Fixes #19638 See also #19641 Basic logic is: * If model type implements some sort of IComparable, then use it * Otherwise, if provider type implement some sore of IComparable, then use it * Otherwise fail in model validation Also added new test suite specifically for different types of keys with and without conversions.
See
KeysWithConvertersCosmosTest
.The same tests with the SQL Server provider build a model where the entity types look like this:
The Cosmos model either has an erroneous string AK property on each entity type:Edit: The model is as expected: https://docs.microsoft.com/en-us/ef/core/providers/cosmos/?tabs=dotnet-core-cli#working-with-disconnected-entities
Or something is wrong about how it is being used:
The text was updated successfully, but these errors were encountered: