Skip to content

Commit 94d32cc

Browse files
committed
Amend PersistenceServiceRegistration
1 parent dff7307 commit 94d32cc

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

AdminLTEWithASPNETCore/Startup.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ public void ConfigureServices(IServiceCollection services)
7272
services.AddScoped(cfg => cfg.GetService<IOptions<AuthenticationSettings>>().Value);
7373
#endregion
7474
#region Setting Db
75-
services.AddDbContext<ApplicationDbContext>(_ => _.UseSqlServer(Configuration.GetConnectionString("ApplicationDbContextConnection")));
76-
7775
var cnnString = Configuration.GetConnectionString("PSCContextConnection");
78-
services.AddDbContext<PSCContext>(_ => _.UseSqlServer(cnnString));
79-
services.ConfigureAudit(cnnString);
76+
services.AddDbContext<ApplicationDbContext>(_ => _.UseSqlServer(Configuration.GetConnectionString("ApplicationDbContextConnection")));
8077
#endregion
8178
#region Dependency Injection
8279
services.AddTransient<IEmailSender, EmailSender>();

AdminLTEWithASPNETCore/appsettings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
},
99
"AllowedHosts": "*",
1010
"ConnectionStrings": {
11-
"ApplicationDbContextConnection": ""
11+
"ApplicationDbContextConnection": "",
12+
"PSCContextConnection": ""
1213
},
1314
"SmtpCredentials": {
1415
"MailFrom": "",

PSC.Repositories/PersistenceServiceRegistration.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ public static class PersistenceServiceRegistration
1919
{
2020
public static IServiceCollection AddPersistenceServices(this IServiceCollection services, IConfiguration configuration)
2121
{
22+
var cnnString = configuration.GetConnectionString("PSCContextConnection");
2223
services.AddDbContext<PSCContext>(options =>
23-
options.UseSqlServer(configuration.GetConnectionString("GloboTicketTicketManagementConnectionString")));
24+
options.UseSqlServer(cnnString));
25+
services.ConfigureAudit(cnnString);
2426

2527
services.AddScoped(typeof(IAsyncRepository<>), typeof(BaseRepository<>));
2628

0 commit comments

Comments
 (0)