CourseWork_EventVisitor/EventVisitor/EventVisitorDatabase/EventVisitorDbContext.cs

22 lines
739 B
C#

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);
}
public virtual DbSet<VisitorEntity> Visitors { get; set; }
public virtual DbSet<OrganizerEntity> Organizers { get; set; }
public virtual DbSet<EventEntity> Events { get; set; }
}
}