using Microsoft.EntityFrameworkCore; using Posechaemost.Data.RemoteData.RemoteDataBase.DAO; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Posechaemost.Data.RemoteData.RemoteDataBase { public class RemoteDataBaseContext: DbContext { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder){ optionsBuilder.UseNpgsql("Host=localhost; Database=presencedb; Username=postgres; Password=123"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasKey(group => group.Id); modelBuilder.Entity().Property(group => group.Id).ValueGeneratedOnAdd(); modelBuilder.Entity().HasKey(user => user.UserId); modelBuilder.Entity().Property(user => user.UserId).ValueGeneratedOnAdd(); modelBuilder.Entity().HasKey(presence => new { presence.User, presence.Date, presence.IsAttendence, presence.ClassNumber }); } public DbSet Groups{ get; set; } public DbSet Users{ get; set; } public DbSet Presences{ get; set; } } }