PIbd-32_Safiulova_K.N._COP/EmployeesDatabaseImplement/EmployeesDatabase.cs

21 lines
743 B
C#

using EmployeesDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace EmployeesDatabaseImplement
{
public class EmployeesDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-6QDRI0N\SQLEXPRESS;Initial Catalog=DatabaseEmployees;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Employee> Employees { set; get; }
public virtual DbSet<Post> Posts { set; get; }
}
}