public static IRegistrator SetupDependencies(this IRegistrator registrator)
 {
     registrator.Register <IIntervallCalculator, IntervallCalculator>();
     registrator.Register <IPolicyFactory, PolicyFactory>();
     registrator.Register <ITownCrier, TownCrier>();
     registrator.RegisterDelegate <IClock>(r => SystemClock.Instance);
     registrator.Register <ITownCrierFactory, TownCrierFactory>();
     registrator.RegisterDelegate <Func <ITownCrier> >(r => () => r.Resolve <ITownCrier>());
     registrator.Register <IExecuteWorkFlowCommand, ExecuteWorkFlowCommand>();
     registrator.Register <ISettingsLoader, SettingsLoader>();
     registrator.Register <IWebsiteDownloader, WebsiteDownloader>();
     registrator.Register <SettingsManager>(Reuse.Singleton);
     registrator.Register <IFileContentComparer, FileContentComparer>();
     registrator.Register <INotifier, Notifier>();
     registrator.Register <IEqualityComparer <HtmlDocument>, HtmlDocumentComparer>();
     registrator.Register <IAltbauWohnungenParser, AltbauWohnungenParser>();
     registrator.RegisterDelegate <Func <Uri, IRestClient> >(r => uri => new RestClient(uri)
     {
         Encoding = Encoding.UTF8
     });
     registrator.Register <IToastNotifier, ToastNotifierWrapper>();
     registrator.RegisterDelegate(r => ToastNotificationManager.CreateToastNotifier("Website Poller"));
     registrator.Register <IAddressFieldParser, AddressFieldParser>();
     registrator.Register <IAltbauWohnungenFilter, AltbauWohnungenFilter>();
     registrator.Register <IAltbauWohnungenRowParser, AltbauWohnungenRowParser>();
     registrator.RegisterDelegate <Func <XmlDocument, ToastNotification> >(r => x => new ToastNotification(x));
     registrator.Register <INotifyHelper, NotifyHelper>();
     registrator.Register <IFormRegistrator, FormRegistrator.FormRegistrator>();
     return(registrator);
 }
Esempio n. 2
0
            private static void RegisterRestObjects(IRegistrator container)
            {
                var apiAssembly = typeof(BearerAuthenticationController).Assembly;
                var ns          = typeof(BearerAuthenticationController).Namespace;

                var restAssemblyTypes = apiAssembly.GetLoadedTypes().Where(i =>
                {
                    return(i.Namespace == ns && !i.IsInterface && !i.IsAbstract && (i.Name.EndsWith("Service") ||
                                                                                    (i.Name.EndsWith("Converter") &&
                                                                                     i.Name !=
                                                                                     "SharedDashboardModelConverter" &&
                                                                                     i.Name !=
                                                                                     "TemporaryProjectTravelsModelConverter" &&
                                                                                     i.Name !=
                                                                                     "ProjectWorkHourPriceModelConverter"
                                                                                    )
                                                                                    ));
                }
                                                                           );

                container.RegisterMany(restAssemblyTypes, Reuse.Scoped, serviceTypeCondition: s => s.IsInterface && s.Namespace == ns, ifAlreadyRegistered: IfAlreadyRegistered.Throw);
                container.Register <IRestSettingsService, RestSettingsService>(Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Replace);
                container.Register <IModelConverter <WorkPriceEx>, WorkHourPriceModelConverter>(Reuse.Scoped, ifAlreadyRegistered: IfAlreadyRegistered.Replace);
                container.Register <IModelConverter <TemporaryProjectTravelExpenseModel>, TemporaryProjectTravelsModelConverter>(Reuse.Scoped, ifAlreadyRegistered: IfAlreadyRegistered.Replace);
                container.Register <PsaReportFactory, PsaReportFactory>(Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Throw);
                container.RegisterDelegate <ReportControllerFactory <IPsaContext> >(c => PsaReportFactory.Factory, Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Throw);
                container.RegisterDelegate <IReportFactoryService <IPsaContext> >(c => PsaReportFactory.Factory, Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Throw);
                container.RegisterDelegate <IPsaReportFactoryService>(c => PsaReportFactory.Factory, Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Throw);
                container.Register <IWhiteListService, WhiteListService>(Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Replace);
            }
Esempio n. 3
0
 public static IRegistrator SetupViewModels(this IRegistrator registrator)
 {
     registrator.Register <ILightsOutGameViewModel, LightsOutGameViewModel>();
     registrator.Register <ISwitchViewModel, SwitchViewModel>();
     registrator.Register <ILevelsLoader, LevelsLoader>();
     registrator.RegisterDelegate <Func <HttpClient> >(r => () => new HttpClient());
     registrator.RegisterDelegate <Func <ISwitchViewModel> >(r => () => r.Resolve <ISwitchViewModel>());
     return(registrator);
 }
 public static IRegistrator SetupMappings(this IRegistrator registrator)
 {
     registrator.RegisterDelegate(r => new MapperConfiguration(cfg =>
     {
         cfg.AddProfile <MappingProfile>();
     }));
     registrator.RegisterDelegate <IMapper>(r => new Mapper(r.Resolve <MapperConfiguration>()), Reuse.Singleton);
     return(registrator);
 }
        public static void RegisterServices(IRegistrator registrator)
        {
            registrator.Register <CurrentUserConfig>(Reuse.Singleton);


            registrator.RegisterDelegate <UserViewModel>(r =>
                                                         r.Resolve <CurrentUserConfig>().GetCurrentUser(),
                                                         Reuse.Singleton);

            //registrator.RegisterDelegate<UserViewModel>(r =>
            //{
            //    return r.Resolve<CurrentUserConfig>().GetCurrentUser();

            //},Reuse.Singleton);

            registrator.Register(typeof(ICoreRepository), typeof(CoreRepository), Reuse.Singleton);
            registrator.Register(typeof(IAccountRepository), typeof(AccountRepository), Reuse.Singleton);
            registrator.Register(typeof(IIndentsRepository), typeof(IndentsRepository), Reuse.Singleton);
            registrator.Register(typeof(IMFBRepository), typeof(MFBRepository), Reuse.Singleton);
            registrator.Register(typeof(IReportRepository), typeof(ReportRepository), Reuse.Singleton);

            registrator.Register(typeof(IAccountService), typeof(AccountService), Reuse.Singleton);
            registrator.Register(typeof(ICoreService), typeof(CoreService), Reuse.Singleton);
            registrator.Register(typeof(IIndentService), typeof(IndentService), Reuse.Singleton);
            registrator.Register(typeof(IMFBService), typeof(MFBService), Reuse.Singleton);
            registrator.Register(typeof(IReportService), typeof(ReportService), Reuse.Singleton);
        }
Esempio n. 6
0
        protected override void Load(IRegistrator builder)
        {
            builder.Register <IPageHeadBuilder, PageHeadBuilder>(Reuse.InWebRequest);

            builder.RegisterDelegate <HttpContextBase>(c => {
                return(HttpContext.Current != null ? (new HttpContextWrapper(HttpContext.Current) as HttpContextBase) : (new FakeHttpContext("~/") as HttpContextBase));
            }, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpRequestBase>(c => c.Resolve <HttpContextBase>().Request, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpResponseBase>(c => c.Resolve <HttpContextBase>().Response, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpServerUtilityBase>(c => c.Resolve <HttpContextBase>().Server, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpSessionStateBase>(c => c.Resolve <HttpContextBase>().Session, Reuse.InResolutionScope);
        }
Esempio n. 7
0
        public CompositionRoot(IRegistrator container)
        {
            container.Register <IDatastoreDbFactory, DatastoreDbFactory>(Reuse.Singleton);
            container.Register(reuse: Reuse.Singleton, made: Made.Of(r => ServiceInfo.Of <IDatastoreDbFactory>(), f => f.CreateDatastoreDb()));

            container.RegisterDelegate <ServiceFactory>(r => r.Resolve);
            container.RegisterMany(new[] { typeof(IMediator).GetAssembly(), typeof(DatastoreDbFactory).GetAssembly() }, Registrator.Interfaces);
        }
Esempio n. 8
0
        protected override void Load(IRegistrator builder, ITypeFinder typeFinder, SiteConfig config)
        {
            foreach (var type in typeFinder.FindClassesOfType <ISettings>())
            {
                builder.RegisterDelegate(type, (c) =>
                {
                    ISettingService serviceCtx = c.Resolve <ISettingService>();
                    var method = serviceCtx.GetType().GetMethod("LoadSetting").MakeGenericMethod(type);
                    return(method.Invoke(serviceCtx, null));
                }, Reuse.InWebRequest);
            }

            builder.Register <IPageHeadBuilder, PageHeadBuilder>(Reuse.InWebRequest);

            builder.RegisterDelegate <HttpContextBase>(c => {
                return(HttpContext.Current != null ? (new HttpContextWrapper(HttpContext.Current) as HttpContextBase) : (new FakeHttpContext("~/") as HttpContextBase));
            }, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpRequestBase>(c => c.Resolve <HttpContextBase>().Request, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpResponseBase>(c => c.Resolve <HttpContextBase>().Response, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpServerUtilityBase>(c => c.Resolve <HttpContextBase>().Server, Reuse.InResolutionScope);

            builder.RegisterDelegate <HttpSessionStateBase>(c => c.Resolve <HttpContextBase>().Session, Reuse.InResolutionScope);

            builder.Register <IWebHelper, WebHelper>(Reuse.Singleton);
            builder.Register <ICacheManager, MemoryCacheManager>(Reuse.Singleton);
            builder.Register <IRouteRegistrator, RouteRegistrator>(Reuse.Singleton);
            builder.Register <IPluginFinder, PluginFinder>(Reuse.Singleton);
        }
Esempio n. 9
0
        public DryIocConfig(IRegistrator registrator)
        {
            registrator.Register <ITodoListAggregateRepository, TodoListAggregateRepository>();
            registrator.Register <ITodoListWriteRepository, TodoListWriteRepository>();
            registrator.Register <ITodoCommandService, TodoCommandService>();
            registrator.Register <ITodoItemCommandService, TodoItemCommandService>();
            registrator.Register <ITodoQueryService, TodoQueryService>();
            registrator.Register <ITodoListRepository, TodoListRepository>();
            registrator.Register <ITodoItemCommandService, TodoItemCommandService>();
            registrator.Register <IBus, InMemoryBus>();
            registrator.Register <IEventStore, EventStoreImpl>();
            registrator.RegisterDelegate <ILiteDbConnectionOptions>(s => new LiteDbConnectionOptions("App_Data/TodoListQueryDb.db"), Reuse.Singleton);
            registrator.Register <ILiteDbProvider, LiteDbProvider>();
            registrator.RegisterDelegate <IDependencyService>(s => new DryIocDependencyService(s));
            registrator.Register <IStorageSchemeMigrator, StorageSchemeMigrator>();

            registrator.RegisterDelegate <ISqlConnectionProvider>(s => new MsSqlConnectionProvider(@"Data Source=localhost\sqlexpress;Database=TodoCQRS;user id=todo-cqrs;password=123456"));

            registrator.Register <CommandHandlers>();
            registrator.Register <DenormalizerHandlers>();
            registrator.Register <SignalRPublishHandler>();
            registrator.Register <CreateTodoListSaga>();
            registrator.Register <EventHub>();
        }
Esempio n. 10
0
        protected override void Load(IRegistrator builder, ITypeFinder typeFinder, SiteConfig config)
        {
            builder.RegisterDelegate <Func <IList <string>, bool> >(c =>
            {
                return(roles =>
                {
                    var Session = c.Resolve <HttpSessionStateBase>();
                    return true;
                });
            }, serviceKey: "funcHasRole");

            builder.Register <XmlSiteMap>(Made.Of(() => new XmlSiteMap(Arg.Index <string>(0), Arg.Of <Func <IList <string>, bool> >("funcHasRole")),
                                                  request1 => "~/Administration/sitemap.config"), serviceKey: "adminsitemap");

            //c.Register<XmlSiteMap>(Reuse.Singleton, made: Made.Of(r => ServiceInfo.Of<Factory>(),
            //            f => f.Create("some value") //How do I pass a string to the factory method?
            //        ));

            //builder.RegisterType<XmlSiteMap>().As<XmlSiteMap>()
            //   .WithParameter("fileName", "~/Administration/sitemap.config")
            //   .WithParameter(new ResolvedParameter((pi, ctx) => pi.ParameterType == typeof(Func<IList<string>, bool>), (pi, ctx) => ctx.ResolveNamed("funcHasRole", typeof(Func<IList<string>, bool>))))
            //   .Named<XmlSiteMap>("adminsitemap").InstancePerRequest();
        }
Esempio n. 11
0
        public static void Register(IRegistrator registrator)
        {
            #region General
            registrator.RegisterDelegate <IMapper>(resolver =>
            {
                var mapperConfiguration = new MapperConfiguration(mc =>
                {
                    mc.AddProfile(new MappingProfile());
                });

                return(mapperConfiguration.CreateMapper());
            }, Reuse.Singleton);

            registrator.Register <Lazy <HttpClient> >(Reuse.Scoped);

            registrator.Register <IDbContext, ApplicationDbContext>(Reuse.Scoped);
            registrator.Register(typeof(IRepository <>), typeof(EfRepository <>), Reuse.Scoped);

            registrator.RegisterDelegate(resolver => new Lazy <IMailService>(() =>
            {
                var mailServerSetting = resolver.Resolve <IOptionsSnapshot <MailServerSetting> >().Value;
                return(new MailService(mailServerSetting));
            }), Reuse.Scoped);
            #endregion

            #region Common
            registrator.Register <RandomGenerator>(Reuse.Singleton);
            #endregion

            #region Background Worker
            registrator.Register <IBackgroundJobWrapper, BackgroundJobWrapper>(Reuse.Scoped);
            registrator.Register <IRecurringJobWrapper, RecurringJobWrapper>(Reuse.Scoped);

            // Jobs
            registrator.Register <ISampleJob, SampleJob>(Reuse.Scoped);
            registrator.Register <ISendRecoveryCode, SendRecoveryCode>(Reuse.Scoped);

            // Schedule Jobs
            registrator.Register <ISampleScheduleJob, SampleScheduleJob>(Reuse.Scoped);

            // Recurring Jobs
            registrator.Register <ISampleRecurringJob, SampleRecurringJob>(Reuse.Scoped);
            #endregion

            #region StandardApi.Chatbot
            #endregion

            #region StandardApi.Core

            #region Auth
            registrator.Register <IGetCurrentUserQuery, GetCurrentUserQuery>(Reuse.Scoped);
            registrator.Register <IGetInfoFromTokenQuery, GetInfoFromTokenQuery>(Reuse.Scoped);
            registrator.Register <IGetRoleByUserIdQuery, GetRoleByUserIdQuery>(Reuse.Scoped);
            registrator.Register <IGetUserByAccountQuery, GetUserByAccountQuery>(Reuse.Scoped);
            registrator.Register <IChangePasswordCommand, ChangePasswordCommand>(Reuse.Scoped);
            registrator.Register <IForgotPasswordCommand, ForgotPasswordCommand>(Reuse.Scoped);
            #endregion

            #region User
            registrator.Register <IUploadUserAvatarCommand, UploadUserAvatarCommand>(Reuse.Scoped);
            registrator.Register <IGetUserAvatarQuery, GetUserAvatarQuery>(Reuse.Scoped);
            #endregion

            #endregion
        }
Esempio n. 12
0
        public CompositionRoot(IRegistrator registrator)
        {
            // general
            registrator.RegisterDelegate(resolver => Mapper.Instance, Reuse.Singleton);
            registrator.Register <Lazy <HttpClient> >(Reuse.InWebRequest);
            registrator.Register <IDbContext, ApplicationDbContext>(Reuse.InWebRequest);
            registrator.Register(typeof(IRepository <>), typeof(EfRepository <>), Reuse.InWebRequest);

            // User
            registrator.Register <IGetUserInfoLoginQuery, GetUserInfoLoginQuery>(Reuse.InWebRequest);
            registrator.Register <IGetUserInfoQuery, GetUserInfoQuery>(Reuse.InWebRequest);

            // Permission
            registrator.Register <IGetPermissionByUserIdQuery, GetPermissionByUserIdQuery>(Reuse.InWebRequest);

            // Category
            registrator.Register <IGetCategoryQuery, GetCategoryQuery>(Reuse.InWebRequest);
            registrator.Register <ISaveCategoryCommand, SaveCategoryCommand>(Reuse.InWebRequest);

            // Book
            registrator.Register <IGetBookPhotoQuery, GetBookPhotoQuery>(Reuse.InWebRequest);
            registrator.Register <IGetListBookNewQuery, GetListBookNewQuery>(Reuse.InWebRequest);
            registrator.Register <IGetBookDetailQuery, GetBookDetailQuery>(Reuse.InWebRequest);
            registrator.Register <IGetBookSectionQuery, GetBookSectionQuery>(Reuse.InWebRequest);
            registrator.Register <IGetListBookQuery, GetListBookQuery>(Reuse.InWebRequest);
            registrator.Register <ICheckBookCodeExistsQuery, CheckBookCodeExistsQuery>(Reuse.InWebRequest);
            registrator.Register <ISaveBookCommand, SaveBookCommand>(Reuse.InWebRequest);
            registrator.Register <IGetBookByBookCodeQuery, GetBookByBookCodeQuery>(Reuse.InWebRequest);
            registrator.Register <ISaveBookImageCommand, SaveBookImageCommand>(Reuse.InWebRequest);
            registrator.Register <IBookBorrowAmountQuery, BookBorrowAmountQuery>(Reuse.InWebRequest);

            // Cart
            registrator.Register <IGetBookInCartForBorrowQuery, GetBookInCartForBorrowQuery>(Reuse.InWebRequest);
            registrator.Register <IGetListBookInCartQuery, GetListBookInCartQuery>(Reuse.InWebRequest);
            registrator.Register <IGetBookInCartDetailQuery, GetBookInCartDetailQuery>(Reuse.InWebRequest);
            registrator.Register <IGetSlotAvailableQuery, GetSlotAvailableQuery>(Reuse.InWebRequest);
            registrator.Register <IAddBookToCartCommand, AddBookToCartCommand>(Reuse.InWebRequest);
            registrator.Register <IDeleteToCartCommand, DeleteToCartCommand>(Reuse.InWebRequest);
            registrator.Register <IUpdateStatusBookInCartCommand, UpdateStatusBookInCartCommand>(Reuse.InWebRequest);
            registrator.Register <IBorrowBookCommand, BorrowBookCommand>(Reuse.InWebRequest);
            registrator.Register <IGetBookViewByCategoryQuery, GetBookViewByCategoryQuery>(Reuse.InWebRequest);

            // Favorite
            registrator.Register <IUpdateBookFavoriteCommand, UpdateBookFavoriteCommand>(Reuse.InWebRequest);

            // User book
            registrator.Register <IGetBookBorrowQuery, GetBookBorrowQuery>(Reuse.InWebRequest);
            registrator.Register <IGetListBookByRequestCodeQuery, GetListBookByRequestCodeQuery>(Reuse.InWebRequest);
            registrator.Register <ITakenBookCommand, TakenBookCommand>(Reuse.InWebRequest);
            registrator.Register <IReturnBookCommand, ReturnBookCommand>(Reuse.InWebRequest);
            registrator.Register <ICancelBookCommand, CancelBookCommand>(Reuse.InWebRequest);

            // Search
            registrator.Register <ISearchBookQuery, SearchBookQuery>(Reuse.InWebRequest);

            // User notification
            registrator.Register <IGetUserNotificationQuery, GetUserNotificationQuery>(Reuse.InWebRequest);

            // Request
            registrator.Register <IGetRequestInfoByCodeQuery, GetRequestInfoByCodeQuery>(Reuse.InWebRequest);

            // Publisher
            registrator.Register <IGetListPublisherQuery, GetListPublisherQuery>(Reuse.InWebRequest);
            registrator.Register <ISavePublisherCommand, SavePublisherCommand>(Reuse.InWebRequest);

            // Supplier
            registrator.Register <IGetListSupplier, GetListSupplier>(Reuse.InWebRequest);
            registrator.Register <ISaveSupplierCommand, SaveSupplierCommand>(Reuse.InWebRequest);

            // Admin
            registrator.Register <IGetListUserNotReturnBookQuery, GetListUserNotReturnBookQuery>(Reuse.InWebRequest);
            registrator.Register <IReadStatisticQuery, ReadStatisticQuery>(Reuse.InWebRequest);
            registrator.Register <IGetBorrowStatusQuery, GetBorrowStatusQuery>(Reuse.InWebRequest);
            registrator.Register <IGetCategoryReportQuery, GetCategoryReportQuery>(Reuse.InWebRequest);

            // Library
            registrator.Register <IGetListLibraryQuery, GetListLibraryQuery>(Reuse.InWebRequest);
            registrator.Register <ISaveLibraryCommand, SaveLibraryCommand>(Reuse.InWebRequest);
        }
Esempio n. 13
0
        public void RegisterDependencies(IRegistrator registrar)
        {
            // settings register for access across app
            registrar.Register <IDatabaseSettings, DatabaseSettings>(reuse: Reuse.Singleton, ifAlreadyRegistered: IfAlreadyRegistered.Keep);
            //caching
            registrar.Register <ICacheProvider, MemoryCacheProvider>(reuse: Reuse.Singleton);
            registrar.Register <ICacheAccountant, CacheAccountant>(reuse: Reuse.Transient);
            //events
            registrar.Register <IEventPublisherService, EventPublisherService>(reuse: Reuse.Singleton);
            //file access
            registrar.Register <ILocalFileProvider, LocalFileProvider>(reuse: Reuse.Singleton);
            //localizer
            registrar.Register <ILocalizer, Localizer>(reuse: Reuse.ScopedOrSingleton);
            //view engine & friends
            registrar.Register <IViewAccountant, ViewAccountant>(reuse: Reuse.Singleton);
            registrar.Register <IAppViewEngine, DefaultAppViewEngine>(reuse: Reuse.Singleton);
            //media
            registrar.Register <IImageProcessor, ImageProcessor>(reuse: Reuse.Singleton);
            registrar.Register <IMediaAccountant, MediaAccountant>(reuse: Reuse.Singleton);
            //plugin loader
            registrar.Register <IPluginAccountant, PluginAccountant>(reuse: Reuse.ScopedOrSingleton);
            //model mapper
            registrar.Register <IModelMapper, ModelMapper>(reuse: Reuse.Singleton);
            //routetemplate parser
            registrar.Register <IRouteTemplateParser, RouteTemplateParser>(reuse: Reuse.Singleton);
            registrar.Register <IDynamicRouteProvider, DynamicRouteProvider>(reuse: Reuse.ScopedOrSingleton);
            //themes
            registrar.Register <IThemeProvider, ThemeProvider>(reuse: Reuse.Singleton);
            //view compoenent
            registrar.Register <IViewComponentManager, ViewComponentManager>(reuse: Reuse.ScopedOrSingleton);
            //search query
            registrar.Register <ISearchQueryParserService, SearchQueryParserService>(reuse: Reuse.Scoped);
            //html processor
            registrar.Register <IHtmlProcessor, HtmlProcessor>(reuse: Reuse.Singleton);
            //email sender
            registrar.Register <IEmailSender, EmailSender>(reuse: Reuse.Transient);
            //bundler
            registrar.Register <IBundleService, BundleService>(reuse: Reuse.Transient);
            //minifier
            registrar.Register <IMinifier, Minifier>(reuse: Reuse.Transient);
            //interceptor
            registrar.Register <IInterceptorService, InterceptorService>(reuse: Reuse.Singleton);
            //conection accountant
            registrar.Register <IConnectionAccountant, ConnectionAccountant>(Reuse.Transient);
            var asm      = AssemblyLoader.GetAppDomainAssemblies();
            var allTypes = asm.Where(x => !x.IsDynamic).SelectMany(x =>
            {
                try
                {
                    return(x.GetTypes());
                }
                catch (ReflectionTypeLoadException)
                {
                    return(new Type[0]);
                }
            })
                           .Where(x => x.IsPublic && !x.IsAbstract).ToList();

            //find all the model factories
            var allModelFactories = allTypes
                                    .Where(type => type.GetInterfaces()
                                           .Any(x => x.IsAssignableTo(typeof(IModelFactory))));// which implementing some interface(s)

            //all consumers which are not interfaces
            registrar.RegisterMany(allModelFactories);

            //capability providers
            var allCapabilityProviderTypes = allTypes
                                             .Where(type => type.GetInterfaces()
                                                    .Any(x => x.IsAssignableTo(typeof(ICapabilityProvider))));// which implementing some interface(s)

            //all providers which are not interfaces
            registrar.RegisterMany(allCapabilityProviderTypes);

            //tasks
            var allTaskTypes = allTypes
                               .Where(type => type.GetInterfaces()
                                      .Any(x => x.IsAssignableTo(typeof(ITask))));// which implementing some interface(s)

            //all providers which are not interfaces
            registrar.RegisterMany <ITask>(allTaskTypes, type => type.FullName);

            //interceptors
            var allInterceptorTypes = allTypes
                                      .Where(type => type.GetInterfaces()
                                             .Any(x => x.IsAssignableTo(typeof(IInterceptor))));// which implementing some interface(s)

            //all providers which are not interfaces
            registrar.RegisterMany <IInterceptor>(allInterceptorTypes, type => type.FullName);

            //currency providers
            var allCurrencyProviders = allTypes
                                       .Where(type => type.IsPublic &&                                     // get public types
                                              type.GetInterfaces()
                                              .Any(x => x.IsAssignableTo(typeof(ICurrencyRateProvider)))); // which implementing some interface(s)

            //all providers which are not interfaces
            registrar.RegisterMany <ICurrencyRateProvider>(allCurrencyProviders, type => type.FullName);

            //find all the event captures
            var allEventCaptures = allTypes
                                   .Where(type => type.GetInterfaces()
                                          .Any(x => x.IsAssignableTo(typeof(IEventCapture))));// which implementing some interface(s)

            //registrar.RegisterMany<IEventCapture>();
            //all consumers which are not interfaces
            registrar.RegisterMany <IEventCapture>(allEventCaptures, type => type.FullName);

            //services
            //to register services, we need to get all types from services assembly and register each of them;
            var serviceAssembly = asm.First(x => x.FullName.Contains("EvenCart.Services,"));
            var serviceTypes    = serviceAssembly.GetTypes().
                                  Where(type => type.IsPublic &&           // get public types
                                        !type.IsAbstract &&                // which are not interfaces nor abstract
                                        type.GetInterfaces().Length != 0); // which implementing some interface(s)

            registrar.RegisterMany(serviceTypes, Reuse.Transient);

            registrar.Register <IFormatterService, FormatterService>(Reuse.Singleton,
                                                                     ifAlreadyRegistered: IfAlreadyRegistered.Replace);

            //find all event consumer types
            var allConsumerTypes = allTypes
                                   .Where(type => type.GetInterfaces()
                                          .Any(x => x.IsAssignableTo(typeof(IFoundationEvent))));// which implementing some interface(s)

            //all consumers which are not interfaces
            registrar.RegisterMany(allConsumerTypes);

            //components
            //find all event consumer types
            var allComponents = allTypes
                                .Where(type => type.IsClass && type.IsAssignableTo(typeof(FoundationComponent)));// which implementing some interface(s)

            registrar.RegisterMany(allComponents, Reuse.Transient);

            //settings
            var allSettingTypes = TypeFinder.ClassesOfType <ISettingGroup>();

            foreach (var settingType in allSettingTypes)
            {
                var type = settingType;
                registrar.RegisterDelegate(type, resolver =>
                {
                    var storeId = ApplicationEngine.CurrentStore?.Id ?? 0;
                    return(resolver.Resolve <ISettingService>().GetSettings(type, storeId));
                }, reuse: Reuse.Transient);
            }

            registrar.Register <IAppAuthenticationService, AuthenticationService>(reuse: Reuse.Transient);

            var allModules = TypeFinder.ClassesOfType <IPlugin>();

            foreach (var moduleType in allModules)
            {
                var type = moduleType;
                registrar.Register(type, reuse: Reuse.Singleton);
            }
        }