-
Notifications
You must be signed in to change notification settings - Fork 201
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
Odata Bind uses EntityType not EntitySet #511
Comments
I agree that EntitySet name should be preferred to EntityType, I will check this out. As a workaround you can attach either Table or DataContract attribute to a class, e.g. [Table(Name="Ys")] |
The annotations didn't seem to work for me. I tried both Table and DataContract on the class and Column on the property. What did work, is pulling the source into my project and adding:
To metadata.cs just before the entityType.Name is used (line 124).
Does this solution break logic elsewhere? |
Thank you for your finding. I will investigate this further. |
Hi, |
I have also have this issue where the EntityType is used and not the EntitySet, the DataAnnotations also did not work for me. Is there any "clean" way to override the used OData Bind entity name? |
I am having also this issue, I have not digged into the source code yet, but it behaves rather strange. For most of the odata.bindings the entitySet name is used but for the one which actually causes the problem an entity type name is used. |
Possibly just a question, possibly a bug.
Given some simplified metadata:
Odata Service endpoints:
service/v2/Xs(Guid) returns a XResource
service/v2/Ys(Guid) returns a YResource
Attempting to create an XResource entry:
where C#:
backendX = BackendX { y = BackendY(Guid) }
generates odata body:
where I would expect
Changing Type name of "BackendY" to "Y" will make the client correctly find service/v2/Ys(Guid)
It seems the client uses the EntityType and not the EntitySet for trying to best match an unknown type name?
Is there a way to use classes that are not named the same as the model endpoint names?
The text was updated successfully, but these errors were encountered: