persistence/Persistence.Database/Model/PersistenceDbContext.cs
Olga Nemt 828864c112 Тестовые проект(ы) для реализации интерфейсов Persistence:
- Persistence.API
- Persistence.Database
- Persistence.Repository
- Persistence.IntegrationTests
2024-11-14 15:17:43 +05:00

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");
}
}