PIbd-32_Bondarenko_M.S._COP_16/WinForm/DataBaseImplement/DBContext.cs

18 lines
602 B
C#
Raw Normal View History

2023-11-01 21:19:02 +04:00
using DataBaseImplement.Models;
using Microsoft.EntityFrameworkCore;
2023-11-01 21:19:02 +04:00
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; }
}
}