Open junker76 opened 8 years ago
I've duplicated this issue and it seems to be specific to ODataPayloadFormat.Json. Using Atom format for the same requests is working for me.
I've found an issue created for Web API: https://github.com/OData/WebApi/issues/410. It's called "Providing $select on a contained navigation without the key when odata.metadata=full fails" and it probably explains why it works in the browser - because it doesn't set odata.metadata=full.
Can you try to set extra header on request odata.metadata=minimal or odata.metadata=none and see if it changes the behavior?
Thank you for your suggestion. We tried modifying the 'accept' http header as the following:
_clientSettings.BeforeRequest = Sub(r As System.Net.Http.HttpRequestMessage)
For Each h In r.Headers
If h.Key = "Accept" Then
r.Headers.Remove("Accept")
r.Headers.Add("Accept", "application/json, application/xml, application/text; odata.metadata=none")
Exit For
End If
Next
End Sub
Dim client As New ODataClient(_clientSettings)
...
We also noted that the original requests does not contain the 'odata.metadata=full' part.
But the error is still present.
I can take a closer look at this but then I need to be able to either connect to your service or receive a copy your service code with some data, and in addition examples of calls you are making from the client.
I have a similar issue.
I have a class with a rowstamp:
/// <summary>
/// Get or set the date and time this entity was last modified.
/// </summary>
[Column("invl_modified")]
public System.DateTimeOffset ModifiedDate { get; set; }
/// <summary>
/// Get or set the name of whom last modified the entity.
/// </summary>
[Column("invl_modified_by"), Required, MaxLength(CommonEntityValues.StringLongReferenceLength)]
public string ModifiedBy { get; set; }
/// <summary>
/// Get or set the row version stamp of last modification.
/// </summary>
[Column("invl_modified_stamp"), Timestamp]
public byte[] ModifiedStamp { get; set; }
I then hide it from the API:
modelBuilder.EntitySet<InvoiceLine>("InvoiceLine")
.Ignore(p => p.ModifiedStamp);
When my ODataClient requests this record, it receives back:
"The entity instance value of type '...' doesn't have a value for property 'ModifiedStamp'. To compute an entity's metadata, its key and concurrency-token property values must be provided."
However all attempts to recreate this outside of ODataClient have failed. odata.metadata
doesn't cause it.
has a similar issue, but it works with swagger. @object does it have any workaround?
When issuing a select query indicating only some fields, not including the 'RowVersion' one, we get the following error:
"The entity instance value of type '...' doesn't have a value for property 'RowVersion'. To compute an entity's metadata, its key and concurrency-token property values must be provided."
The generated query is the following https://xxx.yyy.com/DataSyncData.svc/Configs?$select=Id,Code,Description,Enabled$filter=Code eq '...' and it works using a web browser
We stated that including the RowVersion field in the select list solve the problem but we are guessing if there is another solution that does not force to include the field. Is RowVersion field related to ETag? Is there a way to disable concurrency management?
Thank you.