30 lines
1020 B
C#
30 lines
1020 B
C#
using Data.RemoteData.DAO;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace data.RemoteData
|
|
{
|
|
public class RemoteDataBaseContext: DbContext
|
|
{
|
|
internal DbSet<GroupDao> Group { get; set; }
|
|
internal DbSet<UserDao> User { get; set; }
|
|
internal DbSet<PresnceDao> Presence { get; set; }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5421;Username=user16;Password=dZ28IVE5;Database=user16");
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<GroupDao>().HasKey(Group => Group.Id);
|
|
modelBuilder.Entity<UserDao>().HasKey(User => User.UserGuid);
|
|
modelBuilder.Entity<PresnceDao>().HasKey(Presence => new {
|
|
Presence.UserGuid,
|
|
Presence.IsAttendensy,
|
|
Presence.Date,
|
|
Presence.LessonNumber,
|
|
});
|
|
}
|
|
}
|
|
}
|