using System; using Microsoft.EntityFrameworkCore; using Npgsql; using System.Collections.Generic; using System.Data.Common; using System.Linq; using System.Reflection.Emit; using System.Text; using System.Threading.Tasks; using Demo.Data.RemoteData.RemoteDataBase.DAO; using Demo.domain.Models; namespace Demo.Data.RemoteData.RemoteDataBase { public class RemoteDatabaseContex : 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=45.67.56.214;Port=5421;Username=user9;Database=user9;Password=X8C8NTnD;"); } 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.IsAttedance, presence.LessonNumber }); } } }