/
kochkatech
/
Queue
Обзор
Документация
Войти
/
kochkatech
/
Queue
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
src/Queue.Data/QueueDbContext.cs
37 строк
1 KB
kochkareal
init: Начальная структура проекта и панель администратора
24 июл 2026, 21:42
24 июл 2026, 21:42
cd5152a
Код
Авторство
О чём код?
using Microsoft.EntityFrameworkCore; using Queue.Core.Models; namespace Queue.Data; public class QueueDbContext : DbContext { private readonly string _dbPath; public QueueDbContext(string dbPath = "queue.db") { _dbPath = dbPath; } public DbSet<Organization> Organizations => Set<Organization>(); public DbSet<Service> Services => Set<Service>(); public DbSet<ServiceWindow> Windows => Set<ServiceWindow>(); public DbSet<Employee> Employees => Set<Employee>(); public DbSet<WorkSchedule> WorkSchedules => Set<WorkSchedule>(); public DbSet<Ticket> Tickets => Set<Ticket>(); public DbSet<IntegrationSetting> IntegrationSettings => Set<IntegrationSetting>(); public DbSet<IntegrationLogEntry> IntegrationLogEntries => Set<IntegrationLogEntry>(); protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite($"Data Source={_dbPath}"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { // Услуга <-> окно: многие ко многим, отдельная таблица связи. modelBuilder.Entity<Service>() .HasMany(s => s.Windows) .WithMany(w => w.Services) .UsingEntity(j => j.ToTable("ServiceWindowAssignments")); } }