CourseWork_BankYouBankrupt/BankYouBankrupt/BankYouBankruptDatabaseImplement/BankYouBancruptDatabase.cs

46 lines
1.6 KiB
C#
Raw Normal View History

2023-04-01 15:33:39 +04:00
using BankYouBankruptDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
2023-03-31 20:21:07 +04:00
using System.Collections.Generic;
2023-04-01 15:33:39 +04:00
using System.ComponentModel;
2023-03-31 20:21:07 +04:00
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankYouBankruptDatabaseImplement
{
2023-04-01 15:33:39 +04:00
public class BankYouBancruptDatabase : DbContext
2023-03-31 20:21:07 +04:00
{
2023-04-01 15:33:39 +04:00
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
if (System.Environment.MachineName == "SHADOWIK")
{
optionsBuilder.UseSqlServer(@"Data Source=SHADOWIK\SHADOWIK;Initial Catalog=BankYouBankrupt;Integrated Security=True;TrustServerCertificate=True");
}
else
{
optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-CFLH20EE\SQLEXPRESS;Initial Catalog=BankYouBankrupt;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
}
2023-04-01 15:33:39 +04:00
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Account> Accounts { set; get; }
2023-04-01 19:36:59 +04:00
2023-04-01 15:33:39 +04:00
public virtual DbSet<Card> Cards { set; get; }
2023-04-01 19:36:59 +04:00
2023-04-01 15:33:39 +04:00
public virtual DbSet<Cashier> Cashiers { set; get; }
2023-04-01 19:36:59 +04:00
2023-04-01 15:33:39 +04:00
public virtual DbSet<CashWithdrawal> CashWithdrawals { set; get; }
2023-04-01 19:36:59 +04:00
2023-04-01 15:33:39 +04:00
public virtual DbSet<Client> Clients { set; get; }
2023-04-01 19:36:59 +04:00
2023-04-01 15:33:39 +04:00
public virtual DbSet<Debiting> Debitings { set; get; }
2023-04-01 19:36:59 +04:00
public virtual DbSet<Crediting> Creditings { set; get; }
2023-04-01 15:33:39 +04:00
2023-04-01 19:36:59 +04:00
public virtual DbSet<MoneyTransfer> MoneyTransfers { set; get; }
2023-04-01 15:33:39 +04:00
}
2023-03-31 20:21:07 +04:00
}