153 lines
5.0 KiB
C#
153 lines
5.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
|
|
namespace MSAdminUsuarios.Context
|
|
{
|
|
public partial class ModelContext : DbContext
|
|
{
|
|
public ModelContext()
|
|
{
|
|
}
|
|
|
|
public ModelContext(DbContextOptions<ModelContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
public virtual DbSet<MICROSERVICIO> MICROSERVICIOs { get; set; } = null!;
|
|
public virtual DbSet<PERMISO> PERMISOSMs { get; set; } = null!;
|
|
public virtual DbSet<PERFIL> PERFILESMs { get; set; } = null!;
|
|
public virtual DbSet<PERFILPORUSUARIO> PERFILESPORUSUARIOs { get; set; } = null!;
|
|
public virtual DbSet<USUARIO> USUARIOSMs { get; set; } = null!;
|
|
public virtual DbSet<CORREOSAREAMS> CORREOSAREAMS { get; set; } = null!;
|
|
public virtual DbSet<USUARIOSTEMP> USUARIOSTEMP { get; set; } = null!;
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
//! Requerido! para instanciar ModelContext sin injeccion
|
|
var config = new ConfigurationBuilder()
|
|
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
|
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
|
.AddJsonFile($"appsettings.Development.json", optional: true, reloadOnChange: true)
|
|
.Build();
|
|
|
|
var ConString = config.GetSection("ConnectionStrings:ConString").Get<string>();
|
|
optionsBuilder.UseOracle(ConString);
|
|
}
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
if (Debugger.IsAttached)
|
|
{
|
|
modelBuilder.HasDefaultSchema("HIMSCAP"); // => AFQ
|
|
}
|
|
else
|
|
{
|
|
modelBuilder.HasDefaultSchema("ADMIN");
|
|
}
|
|
|
|
|
|
modelBuilder.Entity<MICROSERVICIO>(entity =>
|
|
{
|
|
entity.HasKey(e => e.NU_PK_MS)
|
|
.HasName("MICROSERVICIOS_PK");
|
|
|
|
entity.ToTable("MICROSERVICIOS");
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<PERMISO>(entity =>
|
|
{
|
|
entity.HasKey(e => e.NU_PK_PMS)
|
|
.HasName("PERMISOSMS_PK");
|
|
|
|
entity.ToTable("PERMISOSMS");
|
|
});
|
|
|
|
modelBuilder.Entity<PERFIL>(entity =>
|
|
{
|
|
entity.HasKey(e => e.NU_PK_PFL)
|
|
.HasName("PERFILESMS_PK");
|
|
|
|
entity.ToTable("PERFILESMS");
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<PERFILPORUSUARIO>(entity =>
|
|
{
|
|
entity.HasKey(e => e.NU_PK_PFLXUSU)
|
|
.HasName("PERFILESPORUSUARIO_PK");
|
|
|
|
entity.ToTable("PERFILESPORUSUARIO");
|
|
|
|
entity.Property(e => e.TX_UUID_PFLXUSU).HasMaxLength(40);
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<USUARIO>(entity =>
|
|
{
|
|
entity.HasKey(e => e.NU_PK_USUMS)
|
|
.HasName("USUARIOSMS_PK");
|
|
|
|
entity.ToTable("USUARIOSMS");
|
|
|
|
entity.Property(e => e.CL_FIRMA_USUMS).HasColumnType("CLOB");
|
|
|
|
entity.Property(e => e.TX_UUID_USUMS).HasMaxLength(40);
|
|
});
|
|
|
|
modelBuilder.Entity<CORREOSAREAMS>(entity =>
|
|
{
|
|
entity.HasKey(e => e.NU_PK_CRRMS);
|
|
|
|
entity.ToTable("CORREOSAREAMS");
|
|
|
|
});
|
|
|
|
modelBuilder.Entity<USUARIOSTEMP>(entity =>
|
|
{
|
|
entity.HasKey(e => e.NU_PK_USUTMP)
|
|
.HasName("USUARIOSTEMP_PK");
|
|
|
|
entity.ToTable("USUARIOSTEMP");
|
|
|
|
entity.Property(e => e.NU_PK_USUTMP).HasPrecision(10);
|
|
|
|
entity.Property(e => e.FE_FINACTIVACION_USUTMP).HasColumnType("DATE");
|
|
|
|
entity.Property(e => e.FE_INICIOACTIVACION_USUTMP).HasColumnType("DATE");
|
|
|
|
entity.Property(e => e.NU_ESTADO_USUMS).HasPrecision(10);
|
|
|
|
entity.Property(e => e.NU_TIPODOC_USUMS).HasPrecision(10);
|
|
|
|
entity.Property(e => e.TX_CORREO_USUMS).HasMaxLength(200);
|
|
|
|
entity.Property(e => e.TX_NOMBRE_PVD).HasMaxLength(1999);
|
|
|
|
entity.Property(e => e.TX_PKDOC_USUMS).HasMaxLength(200);
|
|
|
|
entity.Property(e => e.TX_PRIMERAPELL_USUMS).HasMaxLength(200);
|
|
|
|
entity.Property(e => e.TX_PRIMERNOM_USUMS).HasMaxLength(200);
|
|
|
|
entity.Property(e => e.TX_SEGUNDOAPELL_USUMS).HasMaxLength(200);
|
|
|
|
entity.Property(e => e.TX_SEGUNDONOM_USUMS).HasMaxLength(200);
|
|
|
|
entity.Property(e => e.TX_TELEFONO_USUMS).HasMaxLength(200);
|
|
});
|
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
}
|
|
|
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
}
|
|
}
|