fix AsbCloudDbContext.RelationUserRolePermissions

This commit is contained in:
Фролов 2021-12-20 15:16:21 +05:00
parent 43bdc9e92e
commit e99f0ff9c9
2 changed files with 10 additions and 8 deletions

View File

@ -41,7 +41,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<DrillFlowChart> DrillFlowChart { get; set; }
public virtual DbSet<RelationUserUserRole> RelationUserUserRoles { get; set; }
public virtual DbSet<Permission> Permissions { get; set; }
public virtual DbSet<Permission> PermissionInfos { get; set; }
public virtual DbSet<RelationUserRolePermission> RelationUserRolePermissions { get; set; }
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
@ -217,12 +217,6 @@ namespace AsbCloudDb.Model
modelBuilder.Entity<DrillParams>(entity =>
{
// entity.HasOne(d => d.Well)
// .WithOne(p => p.)
// .HasForeignKey<Well>(d => d.IdTelemetry)
// .OnDelete(DeleteBehavior.SetNull)
// .HasConstraintName("t_well_t_telemetry_id_fk");
entity.HasOne(r => r.WellSectionType)
.WithMany(w => w.DrillParamsCollection)
.HasForeignKey(r => r.IdWellSectionType)
@ -257,6 +251,14 @@ namespace AsbCloudDb.Model
modelBuilder.Entity<RelationUserRolePermission>(entity =>
{
entity.HasKey(e => new { e.IdUserRole, e.IdPermission });
entity.HasOne(r => r.Permission)
.WithMany(p => p.RelationUserRolePermissions)
.IsRequired();
entity.HasOne(r => r.UserRole)
.WithMany(r => r.RelationUserRolePermissions)
.IsRequired();
});
FillData(modelBuilder);

View File

@ -38,7 +38,7 @@ namespace AsbCloudDb.Model
DbSet<DrillFlowChart> DrillFlowChart { get; set; }
DbSet<RelationUserUserRole> RelationUserUserRoles { get; set; }
DbSet<Permission> Permissions { get; set; }
DbSet<Permission> PermissionInfos { get; set; }
DbSet<RelationUserRolePermission> RelationUserRolePermissions { get; set; }
DatabaseFacade Database { get; }