PIbd-32_Bondarenko_M.S._COP_16/WinForm/DataBaseImplement/DBContext.cs
2023-11-01 21:10:48 +04:00

18 lines
602 B
C#

using DatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace DatabaseImplement
{
public class DBContext:DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if(!optionsBuilder.IsConfigured)
optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=COP;Username=courseuser;Password=courseuser");
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Provider> Providers { get; set; }
public virtual DbSet<Models.Type> Types { get; set; }
}
}