2024-04-21 16:04:37 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using BarDatabaseImplement.Models;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace BarDatabaseImplement
|
|
|
|
|
{
|
|
|
|
|
public class BarDatabase : DbContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
if (optionsBuilder.IsConfigured == false)
|
|
|
|
|
{
|
2024-05-17 23:10:48 +04:00
|
|
|
|
optionsBuilder.UseSqlServer(@"Data Source=.\SQLEXPRESS;Initial Catalog=BarDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True",
|
2024-04-21 16:04:37 +04:00
|
|
|
|
options => options.EnableRetryOnFailure(
|
2024-05-17 23:10:48 +04:00
|
|
|
|
maxRetryCount: 5,
|
2024-04-21 16:04:37 +04:00
|
|
|
|
maxRetryDelay: System.TimeSpan.FromSeconds(30),
|
|
|
|
|
errorNumbersToAdd: null));
|
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
|
|
|
|
}
|
|
|
|
|
public virtual DbSet<Component> Components { get; set; }
|
|
|
|
|
public virtual DbSet<Cocktail> Cocktails { get; set; }
|
|
|
|
|
public virtual DbSet<CocktailComponent> CocktailComponents { get; set; }
|
|
|
|
|
public virtual DbSet<Order> Orders { get; set; }
|
2024-05-08 23:27:46 +04:00
|
|
|
|
public virtual DbSet<Client> Clients { get; set; }
|
2024-05-17 23:10:48 +04:00
|
|
|
|
public virtual DbSet<Implementer> Implementers { set; get; }
|
|
|
|
|
}
|
2024-04-21 16:04:37 +04:00
|
|
|
|
}
|