2023-11-21 12:25:31 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.InMemory;
|
|
|
|
|
|
using WD7UVN_HFT_2023241.Models;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WD7UVN_HFT_2023241.Repository
|
|
|
|
|
|
{
|
|
|
|
|
|
public class CompanyDbContext : DbContext
|
|
|
|
|
|
{
|
2023-11-21 12:33:46 +01:00
|
|
|
|
//Tables
|
2023-11-21 12:25:31 +01:00
|
|
|
|
public DbSet<Customer> Customers { get; set; }
|
|
|
|
|
|
public DbSet<Employee> Employees { get; set; }
|
|
|
|
|
|
public DbSet<MaintainerTeam> Maintainers { get; set; }
|
|
|
|
|
|
public DbSet<Service> Services { get; set; }
|
2023-11-21 12:33:46 +01:00
|
|
|
|
|
|
|
|
|
|
public CompanyDbContext()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Database.EnsureCreated();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!optionsBuilder.IsConfigured)
|
|
|
|
|
|
{
|
|
|
|
|
|
optionsBuilder
|
|
|
|
|
|
.UseInMemoryDatabase("company");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
|
|
}
|
2023-11-21 12:25:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|