2023-02-22 12:12:38 +01:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using WebAPI.Models;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WebAPI
|
|
|
|
|
|
{
|
|
|
|
|
|
public class AppDbContext : DbContext
|
|
|
|
|
|
{
|
|
|
|
|
|
public DbSet<User> Users { get; set; }
|
|
|
|
|
|
public DbSet<Layer> Layers { get; set; }
|
|
|
|
|
|
public DbSet<Record> Records { get; set; }
|
2023-09-18 11:29:25 +02:00
|
|
|
|
public DbSet<ProcessSource> ProcessSources { get; set; }
|
2023-02-22 12:12:38 +01:00
|
|
|
|
|
|
|
|
|
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
|
{
|
2023-09-18 11:29:25 +02:00
|
|
|
|
modelBuilder.Entity<ProcessSource>().HasKey(x => new
|
|
|
|
|
|
{
|
|
|
|
|
|
x.LayerId,
|
|
|
|
|
|
x.SourceId
|
|
|
|
|
|
});
|
2023-02-22 12:12:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static readonly Microsoft.Extensions.Logging.LoggerFactory _myLoggerFactory =
|
|
|
|
|
|
new LoggerFactory(new[] {
|
|
|
|
|
|
new Microsoft.Extensions.Logging.Debug.DebugLoggerProvider()
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
|
{
|
|
|
|
|
|
optionsBuilder.UseLoggerFactory(_myLoggerFactory);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|