using System; using Microsoft.EntityFrameworkCore; public class RemoteDateBaseContext : DbContext { public RemoteDateBaseContext() { } public DbSet Group { get; set; } public DbSet User { get; set; } public DbSet Presence { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5432;Username=postgres;Password= ;Database=user1"); } 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 }); } }