ConfigureServicesExtenions.cs 522 B

12345678910111213141516171819202122
  1. 
  2. namespace BankOperationsUpdate.WorkerService.Extensions;
  3. public static class ConfigureServicesExtenions
  4. {
  5. public static void ConfigurePgSqlContext(this IServiceCollection services, IConfiguration config)
  6. {
  7. var connectionString = config.GetConnectionString("DefaultConnection");
  8. services.AddDbContext<RepositoryContext>(opt => {
  9. opt.UseNpgsql(connectionString, x => x.MigrationsHistoryTable("MigrationHistory", "SEPTEM"));
  10. opt.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
  11. });
  12. }
  13. }