public static void RegisterTypes() { RegistrationBuilder rb = new RegistrationBuilder(); RegisterDbContexts(rb); RegisterRepositories(rb); RegisterControllers(rb); RegisterFactories(rb); RegisterMappers(rb); ServiceLocatorConfig._container = new CompositionContainer( new AssemblyCatalog( Assembly.GetExecutingAssembly(), rb ) ); var resolver = new MefDependencyResolver(ServiceLocatorConfig._container); DependencyResolver.SetResolver(resolver); }