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
Interface IEdmEntitySet include interface IEdmVocabularyAnnotatable, so I can set, for example, optimistic concurrency properties for top-level entity set.
BUT, interface IEdmContainedEntitySet not include IEdmVocabularyAnnotatable, so I can't set optimistic concurrency properties for non-top level entity set.
Probably I am missing something, but element from top-level EntitySet and it child from selecondlevel ContainedEntitySet both can have concurrency properties.
Can somebody explain why contained entity set so restricted that them cannot be annotated?
The text was updated successfully, but these errors were encountered:
Recently updated my project to OData 8.0.8 and issue is still present in 2022.
Reproduce: just add contained entity with concurrency token (in my case user.ContainsMany(userProfiles), userProfile has concurrencyToken declared)
Later if I trying to patch userProfile and set If-Match header in my http request, but in ODataQueryOptions.IfMatch I can't see concurrencyToken, because it is not annotated correctly in edm model.
As a workaround I use following snippet, hope you understand my domain context
public static IEdmModel AddUserProfileConcurrency(this IEdmModel model)
{
var users = model.EntityContainer.FindEntitySet("users");
var user = users.EntityType();
var profiles = (IEdmNavigationProperty) user.FindProperty("profiles");
var profilesTarget = users.FindNavigationTarget(profiles);
var profile = profilesTarget.EntityType();
var concurrencyProperty = (IEdmStructuralProperty) profile.FindProperty("concurrency");
var concurrencyProperties = model.GetAnnotationValue<ConcurrencyPropertiesAnnotation>(model) ??
new ConcurrencyPropertiesAnnotation();
concurrencyProperties[profilesTarget] = new[] {concurrencyProperty};
model.SetAnnotationValue(model, concurrencyProperties);
return model;
}
If I just set .IsConcurrencyToken() on concurrency property, this simply doesn't work, ETagMessageHandler not worked correcly for contained entity sets.
Interface IEdmEntitySet include interface IEdmVocabularyAnnotatable, so I can set, for example, optimistic concurrency properties for top-level entity set.
BUT, interface IEdmContainedEntitySet not include IEdmVocabularyAnnotatable, so I can't set optimistic concurrency properties for non-top level entity set.
Probably I am missing something, but element from top-level EntitySet and it child from selecondlevel ContainedEntitySet both can have concurrency properties.
Can somebody explain why contained entity set so restricted that them cannot be annotated?
The text was updated successfully, but these errors were encountered: