I have many projects in a solution that use bit-framework. I need to register Interfaces in each projects, and have Modular Registration. How can do that?
Imaging you've following modules: "FrontApp + SubSys1 + SubSys2"
AppStartup is as it was before with two modifications:
1- Add following code after AssemblyContainer.Current.Init();
:
AssemblyContainer.Current.AddAppAssemblies(typeof(SubSys1AppModule).GetTypeInfo().Assembly, typeof(SubSys2AppModule).GetTypeInfo().Assembly);
2- Change GetAppModules's body to following:
public IEnumerable<IAppModule> GetAppModules()
{
yield return this;
yield return new SubSys1AppModule();
yield return new SubSys2AppModule();
}
SubSys1AppModule's codes:
public class SubSys1AppModule : IAspNetCoreAppModule // It's possible in owin based apps by implementing IOwinAppModule
{
public virtual void ConfigureDependencies(IServiceProvider serviceProvider, IServiceCollection services, IDependencyManager dependencyManager)
{
dependencyManager.Register<Module1Contract, Module1Implementation>();
}
}