/// <summary> /// Apply settings for class <see cref="TEntity"/>. /// </summary> /// <param name="builder">Instância para aplicar configuração.</param> public void Configure(EntityTypeBuilder <TEntity> builder) { builder.HasKey(entity => entity.Id); builder.Property(entity => entity.Id) .IsRequired(); builder.Property(entity => entity.Status) .IsRequired() .HasColumnType($"varchar({EntityStatus.SizeCodeStatus})") .HasConversion( p => p.Key, p => EntityStatus.GetById(p)); builder.Property(entity => entity.RegisteredBy) .IsRequired(); builder.Property(entity => entity.RegistrationDate) .IsRequired(); builder.Property(entity => entity.ModifiedBy) .IsRequired(false); builder.Property(entity => entity.ModificationDate) .IsRequired(false); builder.Ignore(entity => entity.Action); ConfigureEntity(builder); }
protected bool BeStatus(EntityStatus status) { return(status != null && EntityStatus.GetById(status.Key) != null); }