2024-11-14 15:17:43 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2024-11-15 16:29:15 +05:00
|
|
|
|
using System.Data.Common;
|
2024-11-14 15:17:43 +05:00
|
|
|
|
|
|
|
|
|
namespace Persistence.Database.Model;
|
|
|
|
|
public partial class PersistenceDbContext : DbContext, IPersistenceDbContext
|
|
|
|
|
{
|
|
|
|
|
public DbSet<DataSaub> DataSaub => Set<DataSaub>();
|
2024-11-25 10:05:23 +05:00
|
|
|
|
public DbSet<ChangeLog> ChangeLog => Set<ChangeLog>();
|
2024-11-14 15:17:43 +05:00
|
|
|
|
|
2024-11-15 16:29:15 +05:00
|
|
|
|
public PersistenceDbContext()
|
|
|
|
|
: base()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-14 15:17:43 +05:00
|
|
|
|
public PersistenceDbContext(DbContextOptions<PersistenceDbContext> options)
|
2024-11-15 16:29:15 +05:00
|
|
|
|
: base(options)
|
2024-11-14 15:17:43 +05:00
|
|
|
|
{
|
2024-11-15 16:29:15 +05:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-14 15:17:43 +05:00
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-15 16:29:15 +05:00
|
|
|
|
|
2024-11-14 15:17:43 +05:00
|
|
|
|
}
|