I'm working on an MVC application that will feature a "plugin" architecture.
Basically there will be a main "host" project that will dynamically load other projects at runtime.
We want to move all ASP.NET Identity related stuff into its own separate plugin project.
The main host project already contains an Owin Startup class which has some logic that it needs to run. However, we also need to create an Owin Startup class within the Identity plugin project so we can call ConfigureAuth().
How can I accomplish this?
MvcPluginHost.Web Startup.cs
[assembly: OwinStartupAttribute(typeof(MvcPluginHost.Web.Startup))]
namespace MvcPluginHost.Web
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}
MvcPluginHost.Plugins.IdentityPlugin Startup.cs
[assembly: OwinStartupAttribute(typeof(MvcPluginHost.Plugins.IdentityPlugin.Startup))]
namespace MvcPluginHost.Plugins.IdentityPlugin
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
Partial classes are not meant for this, the first thing that comes to mind is to query the desired assemblies for some interface and call a common method on all of them.