How does one get a list of all metadata about enti

2019-08-26 10:10发布

问题:

When obtaining metadata about all entities in an EF DbContext, it is rather convoluted, having to go through the ObjectContext.

This was greatly cleaned up and simplified in EFCore with a simple line as below:

return dc.Model.GetEntityTypes();

The above returns IEnumerable where dc is an instance of a class derived from DbContext.

The Microsoft.OData.Client.Edm library has EdmEntityType. What I need is a way to return it from an instance of Microsoft.OData.Client.DomainServiceContext.

EdmStructuralProperty and EdmNavigationProperty seem to mirror their equivalents in the EF and EFCore worlds. However I cannot get at the root expression that gives access to the top-level entities to start with.

I have searched and can't seem to find anything that speaks to this.

Can anyone help?

标签: rest odata