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=5433;Username=myuser;Password=mypassword;Database=mydatabase"); } 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 }); } } }