COP-17/WinFormsProject/DateBaseImplement/DBContext.cs

25 lines
743 B
C#

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