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); }
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); }
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); }
public void Initialize(IModuleRegistrar registrar) { registrar.Register(() => _logger, Lifetime.Singleton); }
public void Initialize(IModuleRegistrar registrar) { registrar.Register <ICommandExecutor, CommandExecutor>(Lifetime.Scoped); registrar.Register <IScopeService, UserAccessCompositionRoot>(Lifetime.Scoped); registrar.Register <IUserAccessModule, UserAccessModule>(Lifetime.Scoped); }