예제 #1
0
        public void Initialize(IModuleRegistrar registrar)
        {
            registrar.Register <IUserRepository, UserRepository>(Lifetime.Scoped);
            registrar.Register(
                () =>
            {
                var dbContextOptionsBuilder = new DbContextOptionsBuilder <UserAccessContext>();
                // TODO: fix connection string issue
                dbContextOptionsBuilder.UseSqlServer(_connectionString);
                dbContextOptionsBuilder.ReplaceService <IValueConverterSelector, StronglyTypedIdValueConverterSelector>();

                return(new UserAccessContext(dbContextOptionsBuilder.Options, _loggerFactory));
            }, Lifetime.Scoped
                );

            // TODO: do i need to register DbContext?
            //registrar.Register<DbContext, UserAccessContext>(Lifetime.Scoped);
        }
예제 #2
0
 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);
 }
예제 #3
0
        public void Initialize(IModuleRegistrar registrar)
        {
            var cronExpression = "0/15 * * ? * *";

            registrar.Register(typeof(Job <>), typeof(JobsModule).Assembly, Lifetime.Singleton);
            registrar.Register <IJobFactory, SingletonJobFactory>(Lifetime.Singleton);
            registrar.Register <ISchedulerFactory, StdSchedulerFactory>(Lifetime.Singleton);

            registrar.Register <ILogProvider, SerilogLogProvider>(Lifetime.Singleton);
            registrar.Register <IHostedService, QuartzHostedService>(Lifetime.Singleton);

            registrar.Register(() => new JobSchedule <Job <ProcessInboxCommand> >(cronExpression),
                               Lifetime.Singleton);
            registrar.Register(() => new JobSchedule <Job <ProcessOutboxCommand> >(cronExpression),
                               Lifetime.Singleton);
            registrar.Register(() => new JobSchedule <Job <ProcessInternalCommandsCommand> >(cronExpression),
                               Lifetime.Singleton);
        }
예제 #4
0
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.Register(() => _logger, Lifetime.Singleton);
 }
예제 #5
0
 public void Initialize(IModuleRegistrar registrar)
 {
     registrar.Register <ICommandExecutor, CommandExecutor>(Lifetime.Scoped);
     registrar.Register <IScopeService, UserAccessCompositionRoot>(Lifetime.Scoped);
     registrar.Register <IUserAccessModule, UserAccessModule>(Lifetime.Scoped);
 }