CourseWork_EventVisitor/EventVisitor/EventVisitorDatabase/EventVisitorDbContext.cs

23 lines
814 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; }
public virtual DbSet<SentMessageEntity> SentMessages { get; set; }
}
}