我们的软件中有几个模块作为单个产品提供.激活模块后,这些功能即可使用.我们希望我们的OData API遵循相同的模式.但是,我无法弄清楚如何为已禁用的模块生成$ metadata ignore控制器.基本上我想确定什么是可用的,而不是应用程序启动时间.
我们使用以下类型的鳕鱼来注册路线:
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);
}
Run Code Online (Sandbox Code Playgroud)
因此,如果模块已被激活,我们只希望Module1Entity显示在元数据中.我们已经有代码在模块停用时禁用相关的控制器.
有任何想法吗?