24 lines
966 B
C#
24 lines
966 B
C#
using FishFactoryDatabaseImplement.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace FishFactoryDatabaseImplement
|
|
{
|
|
public class FishFactoryDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory2;Username=postgres;Password=postgres");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
}
|
|
public virtual DbSet<Component> Components { set; get; }
|
|
public virtual DbSet<Canned> Canneds { set; get; }
|
|
public virtual DbSet<CannedComponent> CannedComponents { set; get; }
|
|
public virtual DbSet<Order> Orders { set; get; }
|
|
}
|
|
}
|