PIbd-31_Yakovlev.M.G._COP_16/ComponentProgramming/DatabaseImplement/Database.cs

21 lines
725 B
C#
Raw Normal View History

using DatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace DatabaseImplement
{
public class Database : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=ProvidersDatabase;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Provider> Providers { get; set; }
public virtual DbSet<OrganisationType> OrganisationTypes { get; set; }
}
}