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-04-27 15:00:40 +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(
|
|
|
|
|
maxRetryCount: 5,
|
|
|
|
|
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; }
|
|
|
|
|
}
|
|
|
|
|
}
|