您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LuDatabaseContext.cs 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Microsoft.EntityFrameworkCore;
  2. using Luticate2.Auth.DataAccess.Models;
  3. namespace Luticate2.Auth.DataAccess
  4. {
  5. public partial class LuDatabaseContext : DbContext
  6. {
  7. public LuDatabaseContext(DbContextOptions options) :base(options)
  8. {
  9. }
  10. protected override void OnModelCreating(ModelBuilder modelBuilder)
  11. {
  12. modelBuilder.Entity<lu_authentication_sources>()
  13. .HasKey(c => new { c.id });
  14. modelBuilder.Entity<lu_groups>()
  15. .HasKey(c => new { c.id });
  16. modelBuilder.Entity<lu_users>()
  17. .HasKey(c => new { c.id });
  18. modelBuilder.Entity<lu_users>()
  19. .HasOne(e => e.fk_lu_authentication_sources)
  20. .WithMany(e => e.lu_users_fk)
  21. .HasForeignKey("authentication_source_id")
  22. .HasConstraintName("lu_users_authentication_source_id_fkey");
  23. modelBuilder.Entity<lu_verb_users_groups>()
  24. .HasKey(c => new { c.user_id, c.group_id });
  25. modelBuilder.Entity<lu_verb_users_groups>()
  26. .HasOne(e => e.fk_lu_users)
  27. .WithMany(e => e.lu_verb_users_groups_fk)
  28. .HasForeignKey("user_id")
  29. .HasConstraintName("lu_verb_users_groups_user_id_fkey");
  30. modelBuilder.Entity<lu_verb_users_groups>()
  31. .HasOne(e => e.fk_lu_groups)
  32. .WithMany(e => e.lu_verb_users_groups_fk)
  33. .HasForeignKey("group_id")
  34. .HasConstraintName("lu_verb_users_groups_group_id_fkey");
  35. }
  36. public DbSet<lu_authentication_sources> lu_authentication_sources { get; set; }
  37. public DbSet<lu_groups> lu_groups { get; set; }
  38. public DbSet<lu_users> lu_users { get; set; }
  39. public DbSet<lu_verb_users_groups> lu_verb_users_groups { get; set; }
  40. }
  41. }