using Microsoft.EntityFrameworkCore; using Zurnal.RemaDateBase.DateDao; public class RemoteDateBaseContext : DbContext { public RemoteDateBaseContext() { } public DbSet Group { get; set; } public DbSet User { get; set; } public DbSet Presence { get; set; } public object Groups { get; internal set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Username=postgres;Password=123;Database=postgres"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasKey(group => group.Id); modelBuilder.Entity().Property(group => group.Id).ValueGeneratedOnAdd(); modelBuilder.Entity().HasKey(user => user.Guid); modelBuilder.Entity().Property(user => user.Guid).ValueGeneratedOnAdd(); modelBuilder.Entity().HasKey(presence => new { presence.UserGuid, presence.Date, presence.IsAttendensy, presence.LessonNumber }); } }