34 lines
1.5 KiB
C#
34 lines
1.5 KiB
C#
using BankDatabaseImplement.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace BankDatabaseImplement
|
|
{
|
|
public class BankDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(
|
|
DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseSqlServer(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=BankDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<Client>()
|
|
.HasKey(c => c.Snils);
|
|
}
|
|
public virtual DbSet<Client> Clients { set; get; }
|
|
public virtual DbSet<ClientProgram> ClientPrograms { set; get; }
|
|
public virtual DbSet<ClientDeposit> ClientDeposits { set; get; }
|
|
public virtual DbSet<Currency> Currencies { set; get; }
|
|
public virtual DbSet<Deposit> Deposits { set; get; }
|
|
public virtual DbSet<DepositCurrency> DepositCurrencies { set; get; }
|
|
public virtual DbSet<Program> Programs { set; get; }
|
|
public virtual DbSet<ProgramCurrency> ProgramCurrencies { set; get; }
|
|
public virtual DbSet<Refill> Refills { set; get; }
|
|
public virtual DbSet<Term> Terms { set; get; }
|
|
public virtual DbSet<Worker> Workers { set; get; }
|
|
}
|
|
} |