SUBD_SportCompetitions/SportCompetitionsDatabaseImplement/SportCompetitionsDatabase.cs

32 lines
1.0 KiB
C#
Raw Normal View History

2024-04-23 19:48:02 +04:00
using Microsoft.EntityFrameworkCore;
2024-04-23 20:01:08 +04:00
using SportCompetitionsDatabaseImplement.Models;
2024-04-23 19:48:02 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SportCompetitionsDatabaseImplement
{
public class SportCompetitionsDatabase : DbContext
{
2024-04-23 20:01:08 +04:00
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SportCompetitionsDatabase;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
2024-04-23 19:48:02 +04:00
2024-04-23 20:01:08 +04:00
public virtual DbSet<Competition> Competitions { get; set; }
public virtual DbSet<Member> Members { get; set; }
public virtual DbSet<Record> Records { get; set; }
public virtual DbSet<Result> Results { get; set; }
public virtual DbSet<Team> Teams { get; set; }
2024-04-23 19:48:02 +04:00
}
}