File tree Expand file tree Collapse file tree 4 files changed +45
-16
lines changed
Repositories/Resgrid.Repositories.DataRepository/Modules Expand file tree Collapse file tree 4 files changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,20 @@ protected override void Load(ContainerBuilder builder)
1818 builder . RegisterType < StandardIsolation > ( ) . As < IISolationLevel > ( ) . InstancePerLifetimeScope ( ) ;
1919
2020 builder . RegisterType < QueryList > ( ) . As < IQueryList > ( ) . InstancePerLifetimeScope ( ) ;
21- //builder.RegisterType<SqlServerConfiguration>().As<SqlConfiguration>().InstancePerLifetimeScope();
22- builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
21+
22+ if ( Config . DataConfig . DatabaseType == Config . DatabaseTypes . Postgres )
23+ {
24+ builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
25+ builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
26+ }
27+ else
28+ {
29+ builder . RegisterType < SqlServerConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
30+ builder . RegisterType < SqlServerConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
31+ }
32+
2333 builder . RegisterType < UnitOfWork > ( ) . As < IUnitOfWork > ( ) . InstancePerLifetimeScope ( ) ;
2434 builder . RegisterType < QueryFactory > ( ) . As < IQueryFactory > ( ) . InstancePerLifetimeScope ( ) ;
25- //builder.RegisterType<SqlServerConnectionProvider>().As<IConnectionProvider>().InstancePerLifetimeScope();
26- builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
2735
2836 // Custom Repositories
2937 builder . RegisterType < UserStatesRepository > ( ) . As < IUserStatesRepository > ( ) . InstancePerLifetimeScope ( ) ;
Original file line number Diff line number Diff line change @@ -17,13 +17,20 @@ protected override void Load(ContainerBuilder builder)
1717 {
1818 builder . RegisterType < StandardIsolation > ( ) . As < IISolationLevel > ( ) . InstancePerLifetimeScope ( ) ;
1919
20+ if ( Config . DataConfig . DatabaseType == Config . DatabaseTypes . Postgres )
21+ {
22+ builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
23+ builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
24+ }
25+ else
26+ {
27+ builder . RegisterType < SqlServerConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
28+ builder . RegisterType < SqlServerConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
29+ }
30+
2031 builder . RegisterType < QueryList > ( ) . As < IQueryList > ( ) . InstancePerLifetimeScope ( ) ;
21- //builder.RegisterType<SqlServerConfiguration>().As<SqlConfiguration>().InstancePerLifetimeScope();
22- builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
2332 builder . RegisterType < UnitOfWork > ( ) . As < IUnitOfWork > ( ) . InstancePerLifetimeScope ( ) ;
2433 builder . RegisterType < QueryFactory > ( ) . As < IQueryFactory > ( ) . InstancePerLifetimeScope ( ) ;
25- //builder.RegisterType<SqlServerConnectionProvider>().As<IConnectionProvider>().InstancePerLifetimeScope();
26- builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
2734
2835 // Custom Repositories
2936 builder . RegisterType < UserStatesRepository > ( ) . As < IUserStatesRepository > ( ) . InstancePerLifetimeScope ( ) ;
Original file line number Diff line number Diff line change @@ -17,13 +17,20 @@ protected override void Load(ContainerBuilder builder)
1717 {
1818 builder . RegisterType < StandardIsolation > ( ) . As < IISolationLevel > ( ) . InstancePerLifetimeScope ( ) ;
1919
20+ if ( Config . DataConfig . DatabaseType == Config . DatabaseTypes . Postgres )
21+ {
22+ builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
23+ builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
24+ }
25+ else
26+ {
27+ builder . RegisterType < SqlServerConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
28+ builder . RegisterType < SqlServerConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
29+ }
30+
2031 builder . RegisterType < QueryList > ( ) . As < IQueryList > ( ) . InstancePerLifetimeScope ( ) ;
21- //builder.RegisterType<SqlServerConfiguration>().As<SqlConfiguration>().InstancePerLifetimeScope();
22- builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
2332 builder . RegisterType < UnitOfWork > ( ) . As < IUnitOfWork > ( ) . InstancePerLifetimeScope ( ) ;
2433 builder . RegisterType < QueryFactory > ( ) . As < IQueryFactory > ( ) . InstancePerLifetimeScope ( ) ;
25- //builder.RegisterType<SqlServerConnectionProvider>().As<IConnectionProvider>().InstancePerLifetimeScope();
26- builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
2734
2835 // Custom Repositories
2936 builder . RegisterType < UserStatesRepository > ( ) . As < IUserStatesRepository > ( ) . InstancePerLifetimeScope ( ) ;
Original file line number Diff line number Diff line change @@ -17,13 +17,20 @@ protected override void Load(ContainerBuilder builder)
1717 {
1818 builder . RegisterType < StandardIsolation > ( ) . As < IISolationLevel > ( ) . InstancePerLifetimeScope ( ) ;
1919
20+ if ( Config . DataConfig . DatabaseType == Config . DatabaseTypes . Postgres )
21+ {
22+ builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
23+ builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
24+ }
25+ else
26+ {
27+ builder . RegisterType < SqlServerConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
28+ builder . RegisterType < SqlServerConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
29+ }
30+
2031 builder . RegisterType < QueryList > ( ) . As < IQueryList > ( ) . InstancePerLifetimeScope ( ) ;
21- //builder.RegisterType<SqlServerConfiguration>().As<SqlConfiguration>().InstancePerLifetimeScope();
22- builder . RegisterType < PostgreSqlConfiguration > ( ) . As < SqlConfiguration > ( ) . InstancePerLifetimeScope ( ) ;
2332 builder . RegisterType < UnitOfWork > ( ) . As < IUnitOfWork > ( ) . InstancePerLifetimeScope ( ) ;
2433 builder . RegisterType < QueryFactory > ( ) . As < IQueryFactory > ( ) . InstancePerLifetimeScope ( ) ;
25- //builder.RegisterType<SqlServerConnectionProvider>().As<IConnectionProvider>().InstancePerLifetimeScope();
26- builder . RegisterType < PostgreSqlConnectionProvider > ( ) . As < IConnectionProvider > ( ) . InstancePerLifetimeScope ( ) ;
2734
2835 // Custom Repositories
2936 builder . RegisterType < UserStatesRepository > ( ) . As < IUserStatesRepository > ( ) . InstancePerLifetimeScope ( ) ;
You can’t perform that action at this time.
0 commit comments