using Demo.Data.RemoteData.RemoteDataBase.DAO; using Microsoft.EntityFrameworkCore; namespace Demo.Data.RemoteData.RemoteDataBase { public class RemoteDatabaseContext: DbContext { public DbSet Groups {get; set; } public DbSet Users {get; set;} public DbSet PresenceDaos{get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseNpgsql("Host=localhost;" + "Port=5432;" + "Username=postgres;" + "Password=1234;" + "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.LessonNumber }); } } }