I use ODataConventionModelBuilder to create the Edm Model for Web API OData Service as follows:
ODataModelBuilder builder = new ODataConventionModelBuilder(); builder.Namespace = "X"; builder.ContainerName = "Y"; builder.EntitySet<Z>("Z"); IEdmModel edmModel = builder.GetEdmModel();
Class Z is located in one assembly and there is a public class Q derived from Z located in another assembly.
ODataConventionModelBuilder generates an Edm Model that includes a Q class definition (among other derived classes), and it will be displayed with service metadata. This is undesirable in our case.
When a derived class is not available (for example, defined as internal), such a problem, of course, does not exist.
Is there a way to make ODataConventionModelBuilder NOT automatically show metadata of all derived types?
c # odata asp.net-web-api2
Eugene D. Gubenkov
source share