123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using Microsoft.EntityFrameworkCore;
- using Luticate2.Auth.DataAccess.Models;
-
- namespace Luticate2.Auth.DataAccess
- {
- public partial class LuAuthDatabaseContext : DbContext
- {
- private readonly string _connectionString;
-
- public LuAuthDatabaseContext()
- {
- }
-
- public LuAuthDatabaseContext(string connectionString)
- {
- _connectionString = connectionString;
- }
-
- public LuAuthDatabaseContext(DbContextOptions options) :base(options)
- {
- }
-
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- if (_connectionString != null) {
- optionsBuilder.UseNpgsql(_connectionString);
- }
- }
-
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
-
- modelBuilder.Entity<lu_authentication_sources>()
- .HasKey(c => new { c.id });
-
- modelBuilder.Entity<lu_authentication_sources>()
- .Property(e => e.id)
- .HasDefaultValueSql("get_uuid()");
-
-
-
- modelBuilder.Entity<lu_groups>()
- .HasKey(c => new { c.id });
-
- modelBuilder.Entity<lu_groups>()
- .Property(e => e.id)
- .HasDefaultValueSql("get_uuid()");
-
-
-
- modelBuilder.Entity<lu_tokens>()
- .HasKey(c => new { c.id });
-
-
- modelBuilder.Entity<lu_tokens>()
- .HasOne(e => e.fk_lu_users)
- .WithMany(e => e.lu_tokens_fk)
- .HasForeignKey("user_id")
- .HasConstraintName("lu_tokens_user_id_fkey");
-
-
- modelBuilder.Entity<lu_users>()
- .HasKey(c => new { c.id });
-
- modelBuilder.Entity<lu_users>()
- .Property(e => e.id)
- .HasDefaultValueSql("get_uuid()");
-
-
- modelBuilder.Entity<lu_users>()
- .HasOne(e => e.fk_lu_authentication_sources)
- .WithMany(e => e.lu_users_fk)
- .HasForeignKey("authentication_source_id")
- .HasConstraintName("lu_users_authentication_source_id_fkey");
-
-
- modelBuilder.Entity<lu_verb_users_groups>()
- .HasKey(c => new { c.user_id, c.group_id });
-
-
- modelBuilder.Entity<lu_verb_users_groups>()
- .HasOne(e => e.fk_lu_users)
- .WithMany(e => e.lu_verb_users_groups_fk)
- .HasForeignKey("user_id")
- .HasConstraintName("lu_verb_users_groups_user_id_fkey");
-
- modelBuilder.Entity<lu_verb_users_groups>()
- .HasOne(e => e.fk_lu_groups)
- .WithMany(e => e.lu_verb_users_groups_fk)
- .HasForeignKey("group_id")
- .HasConstraintName("lu_verb_users_groups_group_id_fkey");
-
-
- }
-
- public virtual DbSet<lu_authentication_sources> lu_authentication_sources { get; set; }
-
- public virtual DbSet<lu_groups> lu_groups { get; set; }
-
- public virtual DbSet<lu_tokens> lu_tokens { get; set; }
-
- public virtual DbSet<lu_users> lu_users { get; set; }
-
- public virtual DbSet<lu_verb_users_groups> lu_verb_users_groups { get; set; }
-
- }
- }
|