We have several modules in our software that come as a single product. When the module is activated, these functions become available. We would like our OData APIs to execute the same pattern. However, I cannot figure out how to make the $ metadata controls ignore modules that were disabled. Basically, I want to determine what is available at any time, not the time the application starts.
We use the following type of cod to register routes:
static public void Register(HttpConfiguration config) { config.MapHttpAttributeRoutes(); var builder = new ODataConventionModelBuilder(); builder.EntitySet<Module1Entity>("Module1Entities"); builder.EntitySet<Module2Entity>("Module2Entities"); config.MapODataServiceRoute("odata", "api", builder.GetEdmModel()); } protected void Application_Start(object sender, EventArgs e) { GlobalConfiguration.Configure(Register); }
Therefore, we need the 1Entity module to appear in metadata if the module has been activated. We already have code to disable the associated controller when the module is deactivated.
Any ideas?
source share