You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AlternateKeysODataUriResolver does not support null keys #3415
@Xriuk From OData perspective, key is non-nullable.
For the alternate key, I think you raised a good question. The current implementation, I think, is following up the OData key rule. But, it seems there's no "clear" rules for alternate key.
For example:
the property for alternate key should be 'non-nullable'? So far, there's no such check.
what's the logic if the alternate key value is null for multiple entities?
I think nullable properties should be allowed, because null can be a valid value as any other, so the key should work regardless. In SQL there are filters to filter out null values when needed, eg, my alternate key in the example is something like this:
// If null the entity has no alt keypublicstring?AltKey1{get;set;}// Can be null, can be not null only if AltKey1 is not nullpublicstring?AltKey2{get;set;}
And in the db there is a filter:
AltKey1 IS NOT NULL
So both properties are nullable in the model, but in the alt key only one of them, I think adding a IsNullable prop (or even a filter-like method, but that would be more complex) would help.
The ideal would be to mirror SQL unique indexes, as they are very flexible.
Activity
xuzhg commentedon Nov 4, 2025
@Xriuk From OData perspective, key is non-nullable.
For the alternate key, I think you raised a good question. The current implementation, I think, is following up the OData key rule. But, it seems there's no "clear" rules for alternate key.
For example:
Xriuk commentedon Nov 4, 2025
I think nullable properties should be allowed, because null can be a valid value as any other, so the key should work regardless. In SQL there are filters to filter out null values when needed, eg, my alternate key in the example is something like this:
And in the db there is a filter:
So both properties are nullable in the model, but in the alt key only one of them, I think adding a IsNullable prop (or even a filter-like method, but that would be more complex) would help.
The ideal would be to mirror SQL unique indexes, as they are very flexible.