CourseWork_EventVisitor/EventVisitor/EventVisitorDatabase/EventVisitorDbContext.cs

22 lines
739 B
C#
Raw Normal View History

2024-11-03 01:20:30 +04:00
using EventVisitorDatabase.Entities;
using Microsoft.EntityFrameworkCore;
namespace EventVisitorDatabase
{
public class EventVisitorDbContext: DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=EventVisitorBd;Username=postgres;Password=1234");
}
base.OnConfiguring(optionsBuilder);
}
2024-11-03 10:18:08 +04:00
public virtual DbSet<VisitorEntity> Visitors { get; set; }
2024-11-03 01:20:30 +04:00
public virtual DbSet<OrganizerEntity> Organizers { get; set; }
public virtual DbSet<EventEntity> Events { get; set; }
}
}