using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using REC_HUMA.CORE.Entities; namespace REC_HUMA.INFRASTRUCTURE { public partial class RECHUMAContext : DbContext { public RECHUMAContext() { } public RECHUMAContext(DbContextOptions options) : base(options) { } public virtual DbSet Adjunto { get; set; } public virtual DbSet Banco { get; set; } public virtual DbSet Beneficio { get; set; } public virtual DbSet Canton { get; set; } public virtual DbSet Deduccion { get; set; } public virtual DbSet Destinatarios { get; set; } public virtual DbSet DiasAcreditadosPeriodo { get; set; } public virtual DbSet DiasAcreditadosPeriodoHistorico { get; set; } public virtual DbSet DiasFeriados { get; set; } public virtual DbSet Distrito { get; set; } public virtual DbSet Empresa { get; set; } public virtual DbSet EstadoCivil { get; set; } public virtual DbSet EstadoSolicitud { get; set; } public virtual DbSet GradoAcademico { get; set; } public virtual DbSet Habilitado { get; set; } public virtual DbSet HistoricoPagos { get; set; } public virtual DbSet Logs { get; set; } public virtual DbSet Notificaciones { get; set; } public virtual DbSet Pais { get; set; } public virtual DbSet Persona { get; set; } public virtual DbSet Provincia { get; set; } public virtual DbSet Puesto { get; set; } public virtual DbSet SolicitudVacaciones { get; set; } public virtual DbSet Telefono { get; set; } public virtual DbSet TipoAusencia { get; set; } public virtual DbSet TipoIdentificacion { get; set; } public virtual DbSet TipoNombramiento { get; set; } public virtual DbSet TipoTelefono { get; set; } public virtual DbSet TipoVacacion { get; set; } public virtual DbSet Universidad { get; set; } // protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) // { // if (!optionsBuilder.IsConfigured) // { //#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. // optionsBuilder.UseSqlServer("server=SRV-ULQA73\\ULTIMUSATESA;Database=REC-HUMA;Trusted_Connection=True"); // } // } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => { entity.HasKey(e => e.IdAdjunto) .HasName("PK__Adjunto__37A0A61FD9B852B8"); entity.ToTable("Adjunto", "global"); entity.Property(e => e.Archivo) .IsRequired() .IsUnicode(false); entity.Property(e => e.Extension) .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.NombreAdjunto) .HasMaxLength(50) .IsUnicode(false); entity.HasOne(d => d.Id) .WithMany(p => p.Adjunto) .HasForeignKey(d => new { d.IdNotificacion, d.IdPersona }) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Adjunto_Destinatarios1"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdBanco); entity.ToTable("Banco", "catalogo"); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(100); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdBeneficio); entity.ToTable("Beneficio", "catalogo"); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(100); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdCanton) .HasName("PK_Canton_1"); entity.ToTable("Canton", "catalogo"); entity.Property(e => e.IdCanton).ValueGeneratedNever(); entity.Property(e => e.Descripcion).HasMaxLength(50); entity.HasOne(d => d.IdProvinciaNavigation) .WithMany(p => p.Canton) .HasForeignKey(d => d.IdProvincia) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Canton_Provincia"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdDeduccion); entity.ToTable("Deduccion", "catalogo"); entity.Property(e => e.Descripción) .IsRequired() .HasMaxLength(255); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); entity.Property(e => e.Nombre) .IsRequired() .HasMaxLength(50); }); modelBuilder.Entity(entity => { entity.HasKey(e => new { e.IdNotificacion, e.IdPersona }) .HasName("PK_Destinatarios_1"); entity.ToTable("Destinatarios", "global"); entity.HasOne(d => d.IdNotificacionNavigation) .WithMany(p => p.Destinatarios) .HasForeignKey(d => d.IdNotificacion) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Destinatarios_Notificacion"); entity.HasOne(d => d.IdPersonaNavigation) .WithMany(p => p.Destinatarios) .HasForeignKey(d => d.IdPersona) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Destinatarios_Persona"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Periodo); entity.ToTable("DiasAcreditadosPeriodo", "global"); entity.Property(e => e.Periodo).HasColumnType("date"); entity.HasOne(d => d.IdFuncionarioNavigation) .WithMany(p => p.DiasAcreditadosPeriodo) .HasForeignKey(d => d.IdFuncionario) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_DiasAcreditadosPeriodo_Persona"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.Periodo); entity.ToTable("DiasAcreditadosPeriodoHistorico", "global"); entity.Property(e => e.Periodo).HasColumnType("date"); entity.HasOne(d => d.IdPersonaNavigation) .WithMany(p => p.DiasAcreditadosPeriodoHistorico) .HasForeignKey(d => d.IdPersona) .HasConstraintName("FK_DiasAcreditadosPeriodoHistorico_Persona"); entity.HasOne(d => d.IdSolicitudNavigation) .WithMany(p => p.DiasAcreditadosPeriodoHistorico) .HasForeignKey(d => d.IdSolicitud) .HasConstraintName("FK_DiasAcreditadosPeriodoHistorico_SolicitudVacaciones"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdDiaFeriado); entity.ToTable("DiasFeriados", "catalogo"); entity.Property(e => e.Descripcion) .HasMaxLength(150) .IsUnicode(false); entity.Property(e => e.Fecha).HasColumnType("date"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdDistrito) .HasName("PK_Distrito_1"); entity.ToTable("Distrito", "catalogo"); entity.Property(e => e.IdDistrito).ValueGeneratedNever(); entity.Property(e => e.Descripcion).HasMaxLength(80); entity.HasOne(d => d.IdCantonNavigation) .WithMany(p => p.Distrito) .HasForeignKey(d => d.IdCanton) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Distrito_Canton"); entity.HasOne(d => d.IdProvinciaNavigation) .WithMany(p => p.Distrito) .HasForeignKey(d => d.IdProvincia) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Distrito_Provincia"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdEmpresa); entity.ToTable("Empresa", "catalogo"); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); entity.Property(e => e.Nombre) .IsRequired() .HasMaxLength(100); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdEstadoCivil); entity.ToTable("EstadoCivil", "catalogo"); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdEstadoSolicitud); entity.ToTable("EstadoSolicitud", "catalogo"); entity.Property(e => e.Descripcion) .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdGradoAcademico); entity.ToTable("GradoAcademico", "catalogo"); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Habilitado).HasDefaultValueSql("((1))"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdHabilitado) .HasName("PK__Estado__FBB0EDC124CDC4D1"); entity.ToTable("Habilitado", "catalogo"); entity.Property(e => e.IdHabilitado).ValueGeneratedNever(); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Habilitado1).HasColumnName("Habilitado"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdPago) .HasName("PK_IdPago"); entity.ToTable("HistoricoPagos", "catalogo"); entity.Property(e => e.Fecha).HasColumnType("date"); entity.HasOne(d => d.IdPersonaNavigation) .WithMany(p => p.HistoricoPagos) .HasForeignKey(d => d.IdPersona) .HasConstraintName("FK_Persona_HistoricoPagos"); }); modelBuilder.Entity(entity => { entity.Property(e => e.TimeStamp).HasColumnType("datetime"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdNotificacion) .HasName("PK__Notifica__1AA87710C4903258"); entity.ToTable("Notificaciones", "global"); entity.Property(e => e.Asunto) .IsRequired() .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.Cuerpo) .IsRequired() .IsUnicode(false); entity.HasOne(d => d.IdHabilitadoNavigation) .WithMany(p => p.Notificaciones) .HasForeignKey(d => d.IdHabilitado) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Notificaciones_Estado"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdPais); entity.ToTable("Pais", "catalogo"); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(100); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); entity.Property(e => e.Nacionalidad) .IsRequired() .HasMaxLength(100); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdPersona); entity.ToTable("Persona", "global"); entity.Property(e => e.Correo) .IsRequired() .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.Direccion) .IsRequired() .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.FechaAscenso).HasColumnType("datetime"); entity.Property(e => e.FechaIngreso).HasColumnType("datetime"); entity.Property(e => e.FechaNacimiento).HasColumnType("datetime"); entity.Property(e => e.FechaSalida).HasColumnType("datetime"); entity.Property(e => e.IdTipoNombramiento).HasColumnName("idTipoNombramiento"); entity.Property(e => e.NoIdentificacion) .IsRequired() .HasMaxLength(25); entity.Property(e => e.Nombre) .IsRequired() .HasMaxLength(255); entity.Property(e => e.Padecimiento) .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.PrimerApellido) .IsRequired() .HasMaxLength(255); entity.Property(e => e.SalarioBruto).HasColumnType("money"); entity.Property(e => e.SegundoApellido) .IsRequired() .HasMaxLength(255); entity.Property(e => e.Titulo) .IsRequired() .HasMaxLength(100) .IsUnicode(false); entity.HasOne(d => d.IdEmpresaNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdEmpresa) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_Empresa"); entity.HasOne(d => d.IdEstadoCivilNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdEstadoCivil) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_EstadoCivil"); entity.HasOne(d => d.IdGradoAcademicoNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdGradoAcademico) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_GradoAcademico"); entity.HasOne(d => d.IdHabilitadoNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdHabilitado) .HasConstraintName("FK_Persona_Habilitado"); entity.HasOne(d => d.IdPaisNacionalidadNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdPaisNacionalidad) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_Pais"); entity.HasOne(d => d.IdPuestoNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdPuesto) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_Puesto"); entity.HasOne(d => d.IdTipoIdentificacionNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdTipoIdentificacion) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_TipoIdentificacion"); entity.HasOne(d => d.IdTipoNombramientoNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdTipoNombramiento) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_TipoNombramiento"); entity.HasOne(d => d.IdUniversidadNavigation) .WithMany(p => p.Persona) .HasForeignKey(d => d.IdUniversidad) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_Persona_Universidad"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdProvincia); entity.ToTable("Provincia", "catalogo"); entity.Property(e => e.IdProvincia).ValueGeneratedNever(); entity.Property(e => e.Descripcion).HasMaxLength(50); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdPuesto); entity.ToTable("Puesto", "catalogo"); entity.Property(e => e.Competencias) .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(255); entity.Property(e => e.Funciones) .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdSolicitud); entity.ToTable("SolicitudVacaciones", "global"); entity.Property(e => e.AnuladoPor) .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.AprobadoPor) .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.Comentarios) .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.DenegadoPor) .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.FechaAnulacion).HasColumnType("datetime"); entity.Property(e => e.FechaAprobacion).HasColumnType("datetime"); entity.Property(e => e.FechaDenegado).HasColumnType("datetime"); entity.Property(e => e.FechaDesde).HasColumnType("datetime"); entity.Property(e => e.FechaHasta).HasColumnType("datetime"); entity.Property(e => e.FechaSolicitud).HasColumnType("datetime"); entity.Property(e => e.Periodo).HasColumnType("datetime"); entity.HasOne(d => d.EstadoSolicitudNavigation) .WithMany(p => p.SolicitudVacaciones) .HasForeignKey(d => d.EstadoSolicitud) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_SolicitudVacaciones_EstadoSolicitud"); entity.HasOne(d => d.IdPersonaNavigation) .WithMany(p => p.SolicitudVacaciones) .HasForeignKey(d => d.IdPersona) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_SolicitudVacaciones_Persona"); entity.HasOne(d => d.IdTipoVacacionNavigation) .WithMany(p => p.SolicitudVacaciones) .HasForeignKey(d => d.IdTipoVacacion) .HasConstraintName("FK_SolicitudVacaciones_TipoVacacion"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTelefono); entity.ToTable("Telefono", "global"); entity.Property(e => e.NombrePariente).HasMaxLength(100); entity.Property(e => e.Numero).HasMaxLength(8); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTipoAusencia); entity.ToTable("TipoAusencia", "catalogo"); entity.Property(e => e.Descripción) .IsRequired() .HasMaxLength(255); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTipoIdentificacion); entity.ToTable("TipoIdentificacion", "catalogo"); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTipoNombramiento); entity.ToTable("TipoNombramiento", "catalogo"); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Habilitado) .IsRequired() .HasDefaultValueSql("((1))"); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTipoTelefono); entity.ToTable("TipoTelefono", "catalogo"); entity.Property(e => e.Descripcion).HasMaxLength(50); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdTipoVacacion); entity.ToTable("TipoVacacion", "catalogo"); entity.Property(e => e.Descripcion).HasMaxLength(50); }); modelBuilder.Entity(entity => { entity.HasKey(e => e.IdUniversidad); entity.ToTable("Universidad", "catalogo"); entity.Property(e => e.Abreviatura) .IsRequired() .HasMaxLength(50); entity.Property(e => e.Descripcion) .IsRequired() .HasMaxLength(255); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } }