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
would update the Response navigation property on an Event class. This is a :1 relationship and marked as contained, and as such it does not have the requirement of a key.
Key properties of an entity type can now be part of a related entity type provided the navigation path to
the “remote” key property consists only of single-valued, non-nullable segments. And of course, these key
properties need an alias
Given that this is a runtime test, I am not sure it makes any sense to actually keep it.
This is a 1:1 relationship which is contained, so AccountProile per specs does NOT need a key.
It actually does not matter whether the ENTITY has a key or not.
As my code says:
var updatedResponse = await c.For<OdataApi.Event>()
.Key(fetched.Identity)
.NavigateTo(x => x.Response)
Here EventResponse is not a collection and there is a key for the Event. EventResponse actually has a key (for legacy reasons, pending removal), but you are not supposed to use it.
It alls dpends on the navigation. As I am moving from an entity with key throuh a :1 navigation property, a key is not needed because the object is uniquely identivied through the parent key and navigation property. The backend can / has to sort out which response is meant by using the key on the parent.
...if the entity has no key requirement.
As per OData 4.01 it is valid to have an entity without key as contained entity that is unique - i.e. at the end of a :1 relationship.
This, i.e:
would update the Response navigation property on an Event class. This is a :1 relationship and marked as contained, and as such it does not have the requirement of a key.
Reference: http://docs.oasis-open.org/odata/new-in-odata/v4.01/new-in-odata-v4.01.pdf
Element 5.5: New: Key-Less Entity Types
Key properties of an entity type can now be part of a related entity type provided the navigation path to
the “remote” key property consists only of single-valued, non-nullable segments. And of course, these key
properties need an alias
Given that this is a runtime test, I am not sure it makes any sense to actually keep it.
Stack Trace:
Message:
Test method Tests.Api.Odata.Web.Controllers.EventTests.PostPutPatchResponse threw exception:
System.InvalidOperationException: No entry key specified.
Stack Trace:
RequestBuilder.AssertHasKey(FluentCommand command)
RequestBuilder.UpdateRequestAsync(Boolean resultRequired, CancellationToken cancellationToken)
ODataClient.UpdateEntryAsync(FluentCommand command, Boolean resultRequired, CancellationToken cancellationToken)
BoundClient`1.UpdateEntryAsync(Boolean resultRequired, CancellationToken cancellationToken)
EventTests.PostPutPatchResponse() line 270
ThreadOperations.ExecuteWithAbortSafety(Action action)
In this particular case, the check makes no sense and the patch chould be sent without a key for EventResponse.
The text was updated successfully, but these errors were encountered: