Skip to content

Commit

Permalink
Amend PersistenceServiceRegistration
Browse files Browse the repository at this point in the history
  • Loading branch information
erossini committed Apr 1, 2021
1 parent dff7307 commit 94d32cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 1 addition & 4 deletions AdminLTEWithASPNETCore/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddScoped(cfg => cfg.GetService<IOptions<AuthenticationSettings>>().Value);
#endregion
#region Setting Db
services.AddDbContext<ApplicationDbContext>(_ => _.UseSqlServer(Configuration.GetConnectionString("ApplicationDbContextConnection")));

var cnnString = Configuration.GetConnectionString("PSCContextConnection");
services.AddDbContext<PSCContext>(_ => _.UseSqlServer(cnnString));
services.ConfigureAudit(cnnString);
services.AddDbContext<ApplicationDbContext>(_ => _.UseSqlServer(Configuration.GetConnectionString("ApplicationDbContextConnection")));
#endregion
#region Dependency Injection
services.AddTransient<IEmailSender, EmailSender>();
Expand Down
3 changes: 2 additions & 1 deletion AdminLTEWithASPNETCore/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"ApplicationDbContextConnection": ""
"ApplicationDbContextConnection": "",
"PSCContextConnection": ""
},
"SmtpCredentials": {
"MailFrom": "",
Expand Down
4 changes: 3 additions & 1 deletion PSC.Repositories/PersistenceServiceRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ public static class PersistenceServiceRegistration
{
public static IServiceCollection AddPersistenceServices(this IServiceCollection services, IConfiguration configuration)
{
var cnnString = configuration.GetConnectionString("PSCContextConnection");
services.AddDbContext<PSCContext>(options =>
options.UseSqlServer(configuration.GetConnectionString("GloboTicketTicketManagementConnectionString")));
options.UseSqlServer(cnnString));
services.ConfigureAudit(cnnString);

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

Expand Down

0 comments on commit 94d32cc

Please sign in to comment.