CourseWork_EventVisitor/EventVisitor/EventVisitorDatabase/EventVisitorDbContext.cs

23 lines
812 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> VisitorEntities { get; set; }
public virtual DbSet<OrganizerEntity> Organizers { get; set; }
public virtual DbSet<EventEntity> Events { get; set; }
public DbSet<OrganizerEvent> OrganizerEvent { get; set; }
}
}