Good afternoon, I have a document table that has relationship 1 to 0 with another table of Usuario
to return the user name, but I get the error:
Conversion specified is not valid.
My mapping:
public class DocumentoOffConfiguration : EntityTypeConfiguration<DocumentoOff>
{
public DocumentoOffConfiguration()
{
ToTable("DOCUMENTO");
this.Property(x => x.DataCriacao).HasColumnName("DATACRIACAO");
this.Property(x => x.Enviadoar).HasColumnName("STATUS");
this.Property(x => x.UsuarioId).HasColumnName("USUARIO_ID");
}
}
In View
try to show the following field:
<th>
@(Html.SortingColumn("Fiscal", nameof(Model.Usuario.Nome),
"Index", new { Model.Usuario.Nome },
new AjaxOptions { UpdateTargetId = "div-gerenciador-auto-termos-index",
HttpMethod = "POST"
}))
</th>
public UsuarioOffConfiguration()
{
this.ToTable("USUARIO");
this.Property(x => x.UsuarioId)
.HasColumnName("ID");
HasMany(x => x.Documentos)
.WithRequired(x => x.Usuario)
.HasForeignKey(x => x.UsuarioId);
}
But the above mentioned error has been returned to me, can anyone give me a light on how to solve it?