Olga Nemt
828864c112
- Persistence.API - Persistence.Database - Persistence.Repository - Persistence.IntegrationTests
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.Metrics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
|
|
|
namespace Persistence.Database.Model;
|
|
public partial class PersistenceDbContext : DbContext, IPersistenceDbContext
|
|
{
|
|
public DbSet<DataSaub> DataSaub => Set<DataSaub>();
|
|
|
|
public PersistenceDbContext(DbContextOptions<PersistenceDbContext> options)
|
|
{
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
optionsBuilder.UseNpgsql("Host=localhost;Database=persistence;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True;"
|
|
//, builder=>builder.EnableRetryOnFailure(2, System.TimeSpan.FromMinutes(1))
|
|
);
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.HasPostgresExtension("adminpack")
|
|
.HasAnnotation("Relational:Collation", "Russian_Russia.1251");
|
|
}
|
|
|
|
|
|
}
|