public BaseDbContext Create(IDbConfiguration dbConfiguration) { var dbContextOptions = PostgreSqlDbContextOptionsFactory.Create(dbConfiguration); var context = new PostgreSqlDbContext(dbContextOptions); return(context); }
protected override void Load(ContainerBuilder builder) { builder.RegisterType <PostgreSqlDbContext>().AsSelf(); builder.RegisterType <AccountPostgreSqlRepository>().As <IAccountRepository>(); builder.RegisterType <HistoryPostgreSqlRepository>().As <IHistoryRepository>(); builder.RegisterInstance(this.dbConfiguration).As <IDbConfiguration>().SingleInstance(); builder.Register(context => PostgreSqlDbContextOptionsFactory.Create(dbConfiguration)).As <DbContextOptions <BaseDbContext> >(); }