I have anMicrosoft.Odata.Edm.IEdmModeland I am trying to determine what EntitySet each operation belongs to. But it doesn't seem possible. I tried the following:
The problem is thatmatchingEntitySetscan have more than one result. The reason is that the OData model is built this way:
e.g.,
var builder =newODataConventionModelBuilder();
builder.EntitySet<BusinessEntity>("Customers");
builder.EntitySet<BusinessEntity>("Vendors");
builder.EntityType<BusinessEntity>().Collection.Function(nameof(CustomersController.GetRecentCustomers)).ReturnsCollectionFromEntitySet<BusinessEntity>("Customers");
Is the answer simply that OData doesn't support more than one entity set with the same model type? If that is the case why doesn't the builder protect against this?
Thanks for the reply. However, those links talk about adding actions and entities.
I am trying to interrogate the EDM model so I can generate typescript bindings. However, I have an issue where via the EDM model I am unable to determine which endpoint an action belongs to, because I have two EntitySets with the same underlying Entity.
Get I get the data about the action it tells me the underlying type, but not the entity set which means I don't know which endpoint to call that action off of.
None
0 Points
2 Posts
How can I determine the EntitySet that a bound Operation (function or action) belongs to given a...
Jan 29, 2020 06:58 PM|sheamus08|LINK
I have an Microsoft.Odata.Edm.IEdmModel and I am trying to determine what EntitySet each operation belongs to. But it doesn't seem possible. I tried the following:
The problem is that matchingEntitySets can have more than one result. The reason is that the OData model is built this way:
e.g.,
Is the answer simply that OData doesn't support more than one entity set with the same model type? If that is the case why doesn't the builder protect against this?
Contributor
3710 Points
1043 Posts
Re: How can I determine the EntitySet that a bound Operation (function or action) belongs to give...
Jan 30, 2020 06:54 AM|Yongqing Yu|LINK
Hi sheamus,
According to your descriotion, I hope the following links can help you solve your issue:
https://www.odata.org/
Actions and Functions in OData v4 Using ASP.NET Web API 2.2
oData v4 - ordering outer entity on property in related one-to-many entities
Best Regards,
YongQing.
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
2 Posts
Re: How can I determine the EntitySet that a bound Operation (function or action) belongs to give...
Jan 31, 2020 06:46 PM|sheamus08|LINK
Hello,
Thanks for the reply. However, those links talk about adding actions and entities.
I am trying to interrogate the EDM model so I can generate typescript bindings. However, I have an issue where via the EDM model I am unable to determine which endpoint an action belongs to, because I have two EntitySets with the same underlying Entity. Get I get the data about the action it tells me the underlying type, but not the entity set which means I don't know which endpoint to call that action off of.