using System; using Microsoft.EntityFrameworkCore; public class RemoteDateBaseContext: DbContext { public Class() { public DbSet Group { get; set; } public DbSet User { get; set; } public DbSet Presnce { get; set; } protected override void Conector(DbContextOptionsBuilder optionsBulder) { optionsBulder.UseNpgsql("Host=Localhost;" + "Port=5432;" + "Username=postgres;" + "Password=123" + "DateBase=postgres"); } protected override void OnMode(ModelBuilder modelBulder) { modelBulder.Entity().HasKey(Group => Group.Id); modelBulder.Entity().Property(Group => Group.Id).ValueGeneratedOnAdd(); modelBulder.Entity().HasKey(User => User.Guid); modelBulder.Entity().Property(User => User.Guid).ValueGeneratedOnAdd(); modelBulder.Entity().HasKey(Presnce => new { Presnce.UserGuid, Presnce.Date, Presnce.IsAttendensy, Presnce.LessonNumber }); } } }