コード例 #1
0
 private void UnityInitialization(IModuleRegistrar registrar)
 {
     registrar.RegisterInstance(this, new PerThreadLifetimeManager());
     var token = new RegisterToken(registrar);
     this.RegisterCommands(token);
     _commands = token.GetCurrentCommands().ToList();
 }
コード例 #2
0
ファイル: ModuleInit.cs プロジェクト: ronenziv/BlueSpursTest
        /// <summary>Used to register concrete implemtations to the DI container</summary>
        /// <param name="registrar">add implementation to the DI container using this registrar</param>
        public void Initialize(IModuleRegistrar registrar)
        {
            //You can register as many types as you want into the Container

            registrar.RegisterTypeAsSingelton <IExternalProductService, BESTBUYProductService>("BestBuy");
            registrar.RegisterTypeAsSingelton <IExternalProductService, BESTBUYProductService>();
        }
コード例 #3
0
        /// <summary>Used to register concrete implementations to the DI container</summary>
        /// <param name="registrar">add implementation to the DI container using this registrar</param>
        public void Initialize(IModuleRegistrar registrar)
        {
            Contract.Requires(registrar != null);

            registrar.RegisterType <IDAL, DAL>();
            registrar.RegisterType <PersonContext, PersonContext>();
        }
コード例 #4
0
        /// <summary>Used to register concrete implemtations to the DI container</summary>
        /// <param name="registrar">add implementation to the DI container using this registrar</param>
        public void Initialize(IModuleRegistrar registrar)
        {
            //You can register as many types as you want into the Container

            //registrar.RegisterType<ITest, Test>();
            //registrar.RegisterTypeAsSingelton<ITest, Test>();
        }
コード例 #5
0
ファイル: ModuleInit.cs プロジェクト: ronenziv/BlueSpursTest
        /// <summary>Used to register concrete implemtations to the DI container</summary>
        /// <param name="registrar">add implementation to the DI container using this registrar</param>
        public void Initialize(IModuleRegistrar registrar)
        {
            //You can register as many types as you want into the Container

            registrar.RegisterTypeAsSingelton <IExternalProductService, WALMARTProductService>("Walmart");
            registrar.RegisterTypeAsSingelton <IExternalProductService, WALMARTProductService>();
        }
コード例 #6
0
 protected CompositionRootBase()
 {
     Container = new Container();
     Container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
     ModuleRegistrar = new ModuleRegistrar(Container);
     Modules         = new List <IModule>();
 }
コード例 #7
0
ファイル: PackagesRegistrar.cs プロジェクト: 5l1v3r1/Maze-1
        public void Configure(ContainerBuilder builder, IEnumerable <PackageCarrier> packages)
        {
            //https://github.com/autofac/Autofac/blob/41044d7d1a4fa277c628021537d5a12016137c3b/src/Autofac/ModuleRegistrationExtensions.cs#L156
            var moduleFinder = new ContainerBuilder();

            moduleFinder.RegisterInstance(_configurationProvider.ConfigurationRoot);

            moduleFinder.RegisterAssemblyTypes(packages.Select(x => x.Assembly).ToArray())
            .Where(t => typeof(IModule).IsAssignableFrom(t)).As <IModule>();

            IModuleRegistrar registrar = null;

            using (var moduleContainer = moduleFinder.Build())
            {
                foreach (var module in moduleContainer.Resolve <IEnumerable <IModule> >())
                {
                    if (registrar == null)
                    {
                        registrar = builder.RegisterModule(module);
                    }
                    else
                    {
                        registrar.RegisterModule(module);
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Registers modules found in an assembly.
        /// </summary>
        /// <param name="registrar">The module registrar that will make the registrations into the container.</param>
        /// <param name="moduleType">The <see cref="Type"/> of the module to add.</param>
        /// <param name="assemblies">The assemblies from which to register modules.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="registrar"/> or <paramref name="moduleType"/> is <see langword="null"/>.
        /// </exception>
        /// <returns>
        /// The <see cref="IModuleRegistrar"/> to allow
        /// additional chained module registrations.
        /// </returns>
        public static IModuleRegistrar RegisterAssemblyModules(this IModuleRegistrar registrar, Type moduleType, params Assembly[] assemblies)
        {
            if (registrar == null)
            {
                throw new ArgumentNullException(nameof(registrar));
            }

            if (moduleType == null)
            {
                throw new ArgumentNullException(nameof(moduleType));
            }

            var moduleFinder = new ContainerBuilder();

            moduleFinder.RegisterAssemblyTypes(assemblies)
            .Where(t => moduleType.IsAssignableFrom(t))
            .As <IModule>();

            using (var moduleContainer = moduleFinder.Build())
            {
                foreach (var module in moduleContainer.Resolve <IEnumerable <IModule> >())
                {
                    registrar.RegisterModule(module);
                }
            }

            return(registrar);
        }
コード例 #9
0
 public void Initialize(IModuleRegistrar registrar)
 {
     //registrar.RegisterType<INewsLetterService, NewsLetterService>();
     //registrar.RegisterType<ILocalizationService, LocalizationService>();
     //registrar.RegisterType<IUserNewsLetterService, UserNewsLetterService>();
     registrar.RegisterType(typeof(IUserStore <IdentityUserViewModel, long>), typeof(CustomUserStore));
 }
コード例 #10
0
        /// <summary>Used to register concrete implementations to the DI container</summary>
        /// <param name="registrar">add implementation to the DI container using this registrar</param>
        public void Initialize(IModuleRegistrar registrar)
        {
            Contract.Requires(registrar != null);

            registrar.RegisterTypeAsSingelton <ICipher, RijndaelManagedCipher>();
            registrar.RegisterTypeAsSingelton <ISecurity, SecurityService>();
        }
コード例 #11
0
ファイル: ModuleLoader.cs プロジェクト: esrdesign18/Aleph1
        /// <summary>uses MEF to load all the IModule implementations to the Registrar</summary>
        /// <param name="registrar">IModuleRegistrar</param>
        /// <param name="rootPath">path to the root directory of the project</param>
        /// <param name="assemblies">retlative path to the dll to load.</param>
        public static void LoadModulesFromAssemblies(IModuleRegistrar registrar, string rootPath, string[] assemblies)
        {
            Uri           baseUri        = new Uri(rootPath);
            List <string> assembliesPath = assemblies.Select(ass => new Uri(baseUri, ass).LocalPath).ToList();
            string        badPath        = assembliesPath.FirstOrDefault(ap => !File.Exists(ap));

            if (badPath != null)
            {
                throw new Exception($"Could not load {badPath}. Current EXE Dir: {rootPath}. Current BaseUri {baseUri}");
            }

            try
            {
                //Creating a single catalog from all the DLL's
                using (AggregateCatalog catalog = new AggregateCatalog(assembliesPath.Select(ap => new AssemblyCatalog(ap))))
                    using (CompositionContainer compositionContainer = new CompositionContainer(catalog))
                    {
                        //Get all the modules and register them
                        foreach (IModule module in compositionContainer.GetExports <IModule>().Select(e => e.Value))
                        {
                            module.Initialize(registrar);
                        }
                    }
            }
            catch (ReflectionTypeLoadException rtle)
            {
                throw new Exception(String.Join(Environment.NewLine, rtle.LoaderExceptions.Select(e => e.ToString())));
            }
        }
コード例 #12
0
        /// <summary>Used to register concrete implementations to the DI container</summary>
        /// <param name="registrar">add implementation to the DI container using this registrar</param>
        public void Initialize(IModuleRegistrar registrar)
        {
            Contract.Requires(registrar != null);

            registrar.RegisterTypeAsSingelton <DbContextOptions <GenericContext>, DbContextOptions <GenericContext> >(SettingsManager.DBOptions);
            registrar.RegisterType <GenericContext, GenericContext>();
            registrar.RegisterType <IGenericRepo, GenericRepo>();
        }
コード例 #13
0
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterType <ISearchBookService, SearchBookService>();
     registrar.RegisterType <IUserDemandService, UserDemandService>();
     registrar.RegisterType(typeof(IUserStore <IdentityUserViewModel, ObjectId>), typeof(CustomUserStore));
     registrar.RegisterType(typeof(IRoleStore <IdentityRoleViewModel, ObjectId>), typeof(CustomRoleStore));
     registrar.RegisterType <IRefreshTokenService, RefreshTokenService>();
 }
コード例 #14
0
        private void UnityInitialization(IModuleRegistrar registrar)
        {
            registrar.RegisterInstance(this, new PerThreadLifetimeManager());
            var token = new RegisterToken(registrar);

            this.RegisterCommands(token);
            _commands = token.GetCurrentCommands().ToList();
        }
コード例 #15
0
        /// <summary>
        /// Registers modules found in an assembly.
        /// </summary>
        /// <param name="registrar">The module registrar that will make the registrations into the container.</param>
        /// <param name="assemblies">The assemblies from which to register modules.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="registrar"/> is <see langword="null"/>.
        /// </exception>
        /// <returns>
        /// The <see cref="IModuleRegistrar"/> to allow
        /// additional chained module registrations.
        /// </returns>
        public static IModuleRegistrar RegisterAssemblyModules(this IModuleRegistrar registrar, params Assembly[] assemblies)
        {
            if (registrar == null)
            {
                throw new ArgumentNullException(nameof(registrar));
            }

            return(registrar.RegisterAssemblyModules <IModule>(assemblies));
        }
コード例 #16
0
ファイル: DapperModule.cs プロジェクト: PeterShanks/PeTelecom
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.Register <ISqlConnectionFactory>(() => new SqlConnectionFactory(_connectionString), Lifetime.Scoped);
     registrar.Register <IUserDatabaseQueries, UserDatabaseQueries>(Lifetime.Scoped);
     registrar.Register <IUsersCounter, UsersCounter>(Lifetime.Scoped);
     registrar.Register <IInboxMessageDatabaseQueries, InboxMessageDatabaseQueries>(Lifetime.Scoped);
     registrar.Register <IInternalCommandDatabaseQueries, InternalCommandDatabaseQueries>(Lifetime.Scoped);
     registrar.Register <IOutboxDatabaseQueries, OutboxDatabaseQueries>(Lifetime.Scoped);
 }
コード例 #17
0
        /// <summary>
        /// Add a module to the container.
        /// </summary>
        /// <param name="registrar">The module registrar that will make the registration into the container.</param>
        /// <typeparam name="TModule">The module to add.</typeparam>
        /// <exception cref="ArgumentNullException">
        /// Thrown if <paramref name="registrar"/> is <see langword="null"/>.
        /// </exception>
        /// <returns>
        /// The <see cref="IModuleRegistrar"/> to allow
        /// additional chained module registrations.
        /// </returns>
        public static IModuleRegistrar RegisterModule <TModule>(this IModuleRegistrar registrar)
            where TModule : IModule, new()
        {
            if (registrar == null)
            {
                throw new ArgumentNullException(nameof(registrar));
            }

            return(registrar.RegisterModule(new TModule()));
        }
コード例 #18
0
ファイル: ModuleInit.cs プロジェクト: RomKap/aPointer
        public void Initialize(IModuleRegistrar registrar)
        {
            //from dll
            //registrar.RegisterType<IAppointmentService, AppointmentService>();

            //api
            registrar.RegisterType <IAppointmentService, AppointmentServiceClient>(new InjectionConstructor("http://localhost/aPointerAPI/api/Apt/"));
            //registrar.RegisterType<IAppointmentService, AppointmentServiceClient>(new InjectionConstructor("http://localhost:5977/api/Apt/"));
            registrar.RegisterType <IAppointmentService, AppointmentServiceClient>();
        }
コード例 #19
0
 public void Initialize(IModuleRegistrar registrar)
 {
     //registrar.RegisterType<IUnitOfWork, UnitOfWork>();
     //registrar.RegisterType<IUserRepository, UserRepository>();
     //registrar.RegisterType<IKeyGroupRepository, KeyGroupRepository>();
     //registrar.RegisterType<ILocalizationKeyRepository, LocalizationKeyRepository>();
     //registrar.RegisterType<IUserNewsLetterRepository, UserNewsLetterRepository>();
     //registrar.RegisterType<INewsLetterRepository, NewsLetterRepository>();
     registrar.RegisterType(typeof(IBaseRepository <>), typeof(BaseRepository <>));
 }
コード例 #20
0
        /// <summary>
        /// Registers modules found in an assembly.
        /// </summary>
        /// <param name="registrar">The module registrar that will make the registrations into the container.</param>
        /// <param name="assemblies">The assemblies from which to register modules.</param>
        /// <typeparam name="TModule">The type of the module to add.</typeparam>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown if <paramref name="registrar"/> is <see langword="null"/>.
        /// </exception>
        /// <returns>
        /// The <see cref="Autofac.Core.Registration.IModuleRegistrar"/> to allow
        /// additional chained module registrations.
        /// </returns>
        public static IModuleRegistrar RegisterAssemblyModules <TModule>(this IModuleRegistrar registrar, params Assembly[] assemblies)
            where TModule : IModule
        {
            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }

            return(registrar.RegisterAssemblyModules(typeof(TModule), assemblies));
        }
コード例 #21
0
        public void Initialize(IModuleRegistrar registrar)
        {
            registrar.RegisterType <IEmailQueueService, EmailQueueService>();
            registrar.RegisterType <IPdfQueueService, PdfQueueService>();
            registrar.RegisterType <IRequestQueueService, RequestQueueService>();
            registrar.RegisterType(typeof(IUserStore <IdentityUserViewModel, ObjectId>), typeof(CustomUserStore));
            registrar.RegisterType(typeof(IRoleStore <IdentityRoleViewModel, ObjectId>), typeof(CustomRoleStore));

            registrar.RegisterType <IClientService, ClientService>();
            registrar.RegisterType <IRefreshTokenService, RefreshTokenService>();
        }
コード例 #22
0
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterType<IContactUsService, ContactUsService>();
     registrar.RegisterType<ITeamMemberService, TeamMemberService>();
     registrar.RegisterType<ICustomerService, CustomerService>();
     registrar.RegisterType<ICompanyService, CompanyService>();
     registrar.RegisterType<IProductService, ProductService>();
     registrar.RegisterType<IOrderDemoService, OrderDemoService>();
     registrar.RegisterType<IUserService, UserService>();
     registrar.RegisterType<IFeaturesService, FeatureService>();
 }
コード例 #23
0
        /// <summary>Used to register concrete implementations to the DI container</summary>
        /// <param name="registrar">add implementation to the DI container using this registrar</param>
        public void Initialize(IModuleRegistrar registrar)
        {
            Contract.Requires(registrar != null);

            //You can register as many types as you want into the Container

            //registrar.RegisterType<ITest, Test>();
            //registrar.RegisterTypeAsSingelton<ITest, Test>();

            registrar.RegisterTypeAsSingelton <ICaptcha, GoogleRecaptcha>();
        }
コード例 #24
0
ファイル: ModuleInit.cs プロジェクト: nathancrone/CQRS
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterTypeWithPerRequestLife<IUnitOfWork, EFContext>();
     //registrar.RegisterType<IContext, EFContext>();
     registrar.RegisterType<IGenericRepository<Task>, GenericRepository<Task>>();
     registrar.RegisterType<IGenericRepository<Process>, GenericRepository<Process>>();
     registrar.RegisterType<IGenericRepository<Transition>, GenericRepository<Transition>>();
     registrar.RegisterType<IGenericRepository<State>, GenericRepository<State>>();
     registrar.RegisterType<IGenericRepository<StateType>, GenericRepository<StateType>>();
     registrar.RegisterType<IGenericRepository<Action>, GenericRepository<Action>>();
     registrar.RegisterType<IGenericRepository<ActionType>, GenericRepository<ActionType>>();
 }
コード例 #25
0
        private static IModuleRegistrar RegisterModules(
            this ContainerBuilder builder, Assembly assembly)
        {
            IModuleRegistrar result = default(IModuleRegistrar);

            GetAbstractModules(assembly).ForEach(p =>
            {
                result = builder.RegisterModule(p);
            });

            return(result);
        }
コード例 #26
0
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterType <IBookRepository, BookRepository>();
     registrar.RegisterType <IUserDemandRepository, UserDemandRepository>();
     registrar.RegisterType <IUnitOfWork, UnitOfWork>();
     registrar.RegisterType <IUserRepository, UserRepository>();
     registrar.RegisterType <IRoleRepository, RoleRepository>();
     registrar.RegisterType <IRefreshTokenRepository, RefreshTokenRepository>();
     registrar.RegisterType(typeof(IBaseRepository <>), typeof(BaseRepository <>));
     registrar.RegisterType <IMongoClient, MongoClient>(ConfigurationManager.ConnectionStrings["MongoDbConnection"].ConnectionString);
     registrar.RegisterInstanceSingleton(typeof(IMongoDatabase), DataSeeder.GetDataBase());
 }
コード例 #27
0
        public void Initialize(IModuleRegistrar registrar)
        {
            //********* un-comment only usable repositories *********

            //with MicroORM (Dapper)
            registrar.RegisterType <ICommonRepository <Appointee>, AppointeeRepository>();
            registrar.RegisterType <ICommonRepository <Appointer>, AppointerRepository>();

            //with Entity Framework
            //registrar.RegisterType<IDbContext, AptDbContext>(new InjectionConstructor("server=FORD\\sqlExpress;database=AppointDB;Trusted_Connection=True;"));
            //registrar.RegisterType<ICommonRepository<Appointee>, CommonRepositoryEF<Appointee>>();
            //registrar.RegisterType<ICommonRepository<Appointer>, CommonRepositoryEF<Appointer>>();
        }
コード例 #28
0
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterTypeWithContainerControlledLife<IDatabaseFactory, DatabaseFactory>();
     registrar.RegisterTypeWithContainerControlledLife<IUnitOfWork, UnitOfWork>();
     registrar.RegisterTypeWithContainerControlledLife<IContactUsRepository, ContactUsRepository>();
     registrar.RegisterTypeWithContainerControlledLife<ITeamMemberRepository, TeamMemberRepository>();
     registrar.RegisterTypeWithContainerControlledLife<ICustomerRepository, CustomerRepository>();
     registrar.RegisterTypeWithContainerControlledLife<ICompanyRepository, CompanyRepository>();
     registrar.RegisterTypeWithContainerControlledLife<IProductRepository, ProductRepository>();
     registrar.RegisterTypeWithContainerControlledLife<IOrderDemoRepository, OrderDemoRepository>();
     registrar.RegisterType<IUserRepository, UserRepository>();
     registrar.RegisterType<IFeaturesRepository, FeaturesRepository>();
 }
コード例 #29
0
        public void Initialize(ApplicationParameters parameters, IModuleRegistrar registrar)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }

            registrar.RegisterType<IFileWordsService, FileWordsService>();
        }
コード例 #30
0
        public void Initialize(ApplicationParameters parameters, IModuleRegistrar registrar)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }

            registrar.RegisterType <IFileWordsService, FileWordsService>();
        }
コード例 #31
0
        public static IModuleRegistrar RegisterEventstreamModule(
            this IModuleRegistrar builder,
            IConfiguration configuration)
        {
            var connectionString = configuration.GetConnectionString("Events");

            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new ApplicationException("Missing 'Events' connectionstring.");
            }

            return(builder
                   .RegisterModule(new SqlStreamStoreModule(connectionString, Schema.Default))
                   .RegisterModule(new TraceSqlStreamStoreModule(configuration["DataDog:ServiceName"])));
        }
コード例 #32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationRegistrar"/> class.
        /// </summary>
        /// <param name="componentRegistrar">
        /// The <see cref="IComponentRegistrar"/> that will be used to parse
        /// configuration values into component registrations.
        /// </param>
        /// <param name="moduleRegistrar">
        /// The <see cref="IModuleRegistrar"/> that will be used to parse
        /// configuration values into module registrations.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown if <paramref name="componentRegistrar" /> or <paramref name="moduleRegistrar" /> is <see langword="null" />.
        /// </exception>
        public ConfigurationRegistrar(IComponentRegistrar componentRegistrar, IModuleRegistrar moduleRegistrar)
        {
            if (componentRegistrar == null)
            {
                throw new ArgumentNullException("componentRegistrar");
            }

            if (moduleRegistrar == null)
            {
                throw new ArgumentNullException("moduleRegistrar");
            }

            this.ComponentRegistrar = componentRegistrar;
            this.ModuleRegistrar    = moduleRegistrar;
        }
コード例 #33
0
ファイル: ModuleInit.cs プロジェクト: nathancrone/CQRS
        public void Initialize(IModuleRegistrar registrar)
        {
            registrar.RegisterType<IQueryHandler<TasksByStatusQuery, TasksByStatusQueryResult>, TasksByStatusQueryHandler>();
            registrar.RegisterType<IQueryHandler<ByIdQuery, ProcessByIdQueryResult>, ProcessByIdQueryHandler>();
            registrar.RegisterType<IQueryHandler<ByIdQuery, TransitionByIdQueryResult>, TransitionByIdQueryHandler>();
            registrar.RegisterType<IQueryHandler<EmptyQuery, ProcessesAllQueryResult>, ProcessesAllQueryHandler>();
            registrar.RegisterType<IQueryHandler<EmptyQuery, StateTypesAllQueryResult>, StateTypesAllQueryHandler>();
            registrar.RegisterType<IQueryHandler<EmptyQuery, ActionTypesAllQueryResult>, ActionTypesAllQueryHandler>();

            registrar.RegisterType<ICommandHandler<SaveProcessCommand>, SaveProcessCommandHandler>();
            registrar.RegisterType<ICommandHandler<SaveStateCommand>, SaveStateCommandHandler>();
            registrar.RegisterType<ICommandHandler<SaveStateCoordinatesCommand>, SaveStateCoordinatesCommandHandler>();
            registrar.RegisterType<ICommandHandler<SaveTransitionCommand>, SaveTransitionCommandHandler>();
            registrar.RegisterType<ICommandHandler<SaveActionCommand>, SaveActionCommandHandler>();
        }
コード例 #34
0
        private static void ConfigureContainer <TRoot>(ContainerBuilder builder)
        {
            Log.Debug("Container configuration called");
            builder.RegisterType(typeof(TRoot));
            builder.RegisterType(typeof(Log4NetConfigurator));
            builder.RegisterType <LogImpl>().As <ILog>();
            builder.RegisterType <ContainerBuilderFacade>().As <IContainerBuilderFacade>();
            Log.Info("Loading Modules...");
            _moduleRegistrar = LoadModules(builder);
            Log.Info("Modules Loaded");

            Container = builder.Build();
            noOfContainerBuilds++;
            Log.Debug($"Container built ({noOfContainerBuilds}) times, with ({Container.ComponentRegistry.Registrations.Count()}) number of types.");
        }
コード例 #35
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationRegistrar"/> class.
        /// </summary>
        /// <param name="componentRegistrar">
        /// The <see cref="IComponentRegistrar"/> that will be used to parse
        /// configuration values into component registrations.
        /// </param>
        /// <param name="moduleRegistrar">
        /// The <see cref="IModuleRegistrar"/> that will be used to parse
        /// configuration values into module registrations.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown if <paramref name="componentRegistrar" /> or <paramref name="moduleRegistrar" /> is <see langword="null" />.
        /// </exception>
        public ConfigurationRegistrar(IComponentRegistrar componentRegistrar, IModuleRegistrar moduleRegistrar)
        {
            if (componentRegistrar == null)
            {
                throw new ArgumentNullException("componentRegistrar");
            }

            if (moduleRegistrar == null)
            {
                throw new ArgumentNullException("moduleRegistrar");
            }

            this.ComponentRegistrar = componentRegistrar;
            this.ModuleRegistrar = moduleRegistrar;
        }
コード例 #36
0
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterType <IEmailQueueRepository, EmailQueueRepository>();
     registrar.RegisterType <IPdfQueueRepository, PdfQueueRepository>();
     registrar.RegisterType <IRequestQueueRepository, RequestQueueRepository>();
     registrar.RegisterType <IUnitOfWork, UnitOfWork>();
     registrar.RegisterType <IUserRepository, UserRepository>();
     registrar.RegisterType <IRoleRepository, RoleRepository>();
     registrar.RegisterType <IExternalLoginRepository, ExternalLoginRepository>();
     registrar.RegisterType <IRefreshTokenRepository, RefreshTokenRepository>();
     registrar.RegisterType <IClientRepository, ClientRepository>();
     registrar.RegisterType(typeof(IBaseRepository <>), typeof(BaseRepository <>));
     registrar.RegisterType <IMongoClient, MongoClient>(ConfigurationManager.ConnectionStrings["MongoDbConnection"].ConnectionString);
     registrar.RegisterInstanceSingleton(typeof(IMongoDatabase), DataSeeder.GetDataBase());
 }
コード例 #37
0
        public DynamicConsole(
            string prompt,
            IOutput output,
            IModuleRegistrar registrar,
            ConsoleActionCallback<IConsoleCommand> foundCommand,
            ConsoleActionCallback unknownCommand)
        {
            this.Output = output;
            this.Prompt = prompt;
            this.FoundCommand = foundCommand;
            this.UnknownCommand = unknownCommand;

            _commands = new List<IConsoleCommand>();

            UnityInitialization(registrar);
        }
コード例 #38
0
        public DynamicConsole(
            string prompt,
            IOutput output,
            IModuleRegistrar registrar,
            ConsoleActionCallback <IConsoleCommand> foundCommand,
            ConsoleActionCallback unknownCommand)
        {
            this.Output         = output;
            this.Prompt         = prompt;
            this.FoundCommand   = foundCommand;
            this.UnknownCommand = unknownCommand;

            _commands = new List <IConsoleCommand>();

            UnityInitialization(registrar);
        }
コード例 #39
0
        public void Initialize(ApplicationParameters parameters, IModuleRegistrar registrar)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }

            if (!parameters.AutoApplyDbMigrations)
            {
                Database.SetInitializer<FileWordsDataflowDbContext>(null);
            }
            else
            {
                Database.SetInitializer(new FileWordsDataflowDbContextInitializer());
            }

            registrar.RegisterType<IRepository, Repository>();
        }
コード例 #40
0
 public void Initialize(IModuleRegistrar registrar)
 {
     // registrar.RegisterTypeUsingSetter<GlobalSetupHelper>("CompanyService");
 }
コード例 #41
0
ファイル: ModuleInit.cs プロジェクト: nathancrone/Workflow
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterType<IGenericService<Process>, GenericService<Process>>();
     registrar.RegisterType<IProcessService, ProcessService>();
 }
コード例 #42
0
ファイル: ModuleInit.cs プロジェクト: nathancrone/Workflow
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.RegisterType<IGenericRepository<Process>, GenericRepository<Process>>();
 }