|
@@ -21,6 +21,8 @@ public partial class TestBase41pContext : DbContext
|
|
|
|
|
|
public virtual DbSet<Role> Roles { get; set; }
|
|
public virtual DbSet<Role> Roles { get; set; }
|
|
|
|
|
|
|
|
+ public virtual DbSet<Trait> Traits { get; set; }
|
|
|
|
+
|
|
public virtual DbSet<User> Users { get; set; }
|
|
public virtual DbSet<User> Users { get; set; }
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
@@ -74,6 +76,18 @@ public partial class TestBase41pContext : DbContext
|
|
.HasColumnName("role_name");
|
|
.HasColumnName("role_name");
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ modelBuilder.Entity<Trait>(entity =>
|
|
|
|
+ {
|
|
|
|
+ entity.HasKey(e => e.IdTrait).HasName("traits_pk");
|
|
|
|
+
|
|
|
|
+ entity.ToTable("traits");
|
|
|
|
+
|
|
|
|
+ entity.Property(e => e.IdTrait).HasColumnName("id_trait");
|
|
|
|
+ entity.Property(e => e.TraitName)
|
|
|
|
+ .HasColumnType("character varying")
|
|
|
|
+ .HasColumnName("trait_name");
|
|
|
|
+ });
|
|
|
|
+
|
|
modelBuilder.Entity<User>(entity =>
|
|
modelBuilder.Entity<User>(entity =>
|
|
{
|
|
{
|
|
entity.HasKey(e => e.IdUser).HasName("users_pk");
|
|
entity.HasKey(e => e.IdUser).HasName("users_pk");
|
|
@@ -100,6 +114,24 @@ public partial class TestBase41pContext : DbContext
|
|
entity.HasOne(d => d.IdUserNavigation).WithOne(p => p.User)
|
|
entity.HasOne(d => d.IdUserNavigation).WithOne(p => p.User)
|
|
.HasForeignKey<User>(d => d.IdUser)
|
|
.HasForeignKey<User>(d => d.IdUser)
|
|
.HasConstraintName("users_logined_fk");
|
|
.HasConstraintName("users_logined_fk");
|
|
|
|
+
|
|
|
|
+ entity.HasMany(d => d.IdTraits).WithMany(p => p.IdUsers)
|
|
|
|
+ .UsingEntity<Dictionary<string, object>>(
|
|
|
|
+ "UserTrait",
|
|
|
|
+ r => r.HasOne<Trait>().WithMany()
|
|
|
|
+ .HasForeignKey("IdTrait")
|
|
|
|
+ .OnDelete(DeleteBehavior.Restrict)
|
|
|
|
+ .HasConstraintName("user_traits_traits_fk"),
|
|
|
|
+ l => l.HasOne<User>().WithMany()
|
|
|
|
+ .HasForeignKey("IdUser")
|
|
|
|
+ .HasConstraintName("user_traits_users_fk"),
|
|
|
|
+ j =>
|
|
|
|
+ {
|
|
|
|
+ j.HasKey("IdUser", "IdTrait").HasName("user_traits_pk");
|
|
|
|
+ j.ToTable("user_traits");
|
|
|
|
+ j.IndexerProperty<int>("IdUser").HasColumnName("id_user");
|
|
|
|
+ j.IndexerProperty<int>("IdTrait").HasColumnName("id_trait");
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
OnModelCreatingPartial(modelBuilder);
|