12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- using Microsoft.EntityFrameworkCore;
- using ConcursoProjetos.Domain.Entities;
- namespace ConcursoProjetos.Data.Configurations;
- public class CandidatoConfiguration : IEntityTypeConfiguration<Candidato>
- {
- public void Configure(EntityTypeBuilder<Candidato> builder)
- {
- builder.ToTable("Candidato");
- builder.HasKey(p => p.Id);
- builder.Property(p => p.Id)
- .ValueGeneratedOnAdd();
- builder.Property(p => p.IsDeleted)
- .HasColumnType("bit");
- builder.Property(p => p.Cpf)
- .HasColumnType("nvarchar")
- .HasMaxLength(11);
- builder.Property(p => p.NomeCompleto)
- .HasColumnType("nvarchar")
- .HasMaxLength(100);
- builder.Property(p => p.Telefone)
- .HasColumnType("nvarchar")
- .HasMaxLength(20);
- builder.Property(p => p.Email)
- .HasColumnType("nvarchar")
- .HasMaxLength(100);
- builder.Property(p => p.TipoPessoa)
- .HasColumnType("bit");
- builder.Property(p => p.Cnpj)
- .HasColumnType("nvarchar")
- .HasMaxLength(14);
- builder.Property(p => p.EmpresaRazaoSocial)
- .HasColumnType("nvarchar")
- .HasMaxLength(100);
- builder.Property(p => p.EmpresaTelefone)
- .HasColumnType("nvarchar")
- .HasMaxLength(20);
- builder.Property(p => p.EmpresaEmail)
- .HasColumnType("nvarchar")
- .HasMaxLength(100);
- builder.HasOne(c => c.User)
- .WithMany()
- .HasForeignKey(c => c.UserId)
- .OnDelete(DeleteBehavior.Restrict);
- }
- }
|