-2
I have the following table that has the fields(ID, numeronota, clienteID, dataemissao, totalnota, desconto, troco).
In this table there are fields that is null, example the change and discount, I’m looking for this table using EF Core. In the entity this so:
[key]
[Colunm("ID")]
public int ID {get; set;}
[Colunm("NUMERONOTA")]
public int Numeronota{get;set}
[ForeignKey("ID")]
public Cliente ClienteID{get; set;}
[Colunm("DATAEMISSAO")]
public DateTime Dataemissao{get;set;}
[Colunm("TOTALNOTA")]
public double Totalnota{get;set;}
[Colunm("DESCONTO")]
public double? Desconto{get;set;}
[Colunm("TROCO")]
public double? Troco{get; set;}
In the Context class
public DbSet<Cliente> Clientes { get; set; }
public DbSet<Nota> Notas { get; set; }
I’m calling it that
using ( var contexto = new EntidadesContext()) {
contexto.LogSQLToConsole();
foreach (var nota in contexto.Nota )
{
}
}
If I look for the client table with all fields filled in comes normal, only the note table of the error.
Thanks for answering, so I did it, but still the error continues, can not pull the fields that are null in the database, using pure SQL I can do the search using isDBNull, but with Entity Framework I can not do it yet.
– João Neto Relampago Reis
You reviewed the client class as well?
– Leandro Angelo
Thank you very much, I had to put all the fields of all entities as ? , now passed.
– João Neto Relampago Reis