123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- using Microsoft.EntityFrameworkCore;
- using ConcursoProjetos.Domain.Entities;
- namespace ConcursoProjetos.Data.Configurations;
- public class ProjetoConfiguration : IEntityTypeConfiguration<Projeto>
- {
- public void Configure(EntityTypeBuilder<Projeto> builder)
- {
- builder.ToTable("Projeto");
- builder.HasKey(p => p.Id);
- builder.Property(p => p.Id)
- .ValueGeneratedOnAdd();
- builder.Property(p => p.IsDeleted)
- .HasColumnType("bit");
- builder.Property(p => p.Nome)
- .HasColumnType("nvarchar")
- .HasMaxLength(100);
- builder.Property(p => p.NumeroUnidades)
- .HasColumnType("int");
- builder.Property(p => p.ResponsavelTecnicoCpf)
- .HasColumnType("nvarchar")
- .HasMaxLength(11);
- builder.Property(p => p.ResponsavelTecnicoNomeCompleto)
- .HasColumnType("nvarchar")
- .HasMaxLength(100);
- builder.Property(p => p.ResponsavelTecnicoTelefone)
- .HasColumnType("nvarchar")
- .HasMaxLength(20);
- builder.Property(p => p.ResponsavelTecnicoEmail)
- .HasColumnType("nvarchar")
- .HasMaxLength(100);
- builder.HasOne(c => c.Candidato)
- .WithMany()
- .HasForeignKey(c => c.CandidatoId)
- .OnDelete(DeleteBehavior.Restrict);
- }
- }
|