0
would like a help.
When I try to save the records, the following message appears:
23502: null value in column "id" violates not-null Constraint
The primary keys are not auto-increment, I’m using a Function that generate the primary keys for me. My code I’m doing to save:
public async Task Salvar(T obj)
{
Db.Set<T>().Add(obj);
await Db.SaveChangesAsync();//TA DANDO ERRO AQUI
}
My id is already going with a value.
The error says id is null. Probably the error is in the code you are using to generate the id. Do it like this: before saving, use an Alert out another similar code to write the id value on the screen, then you check if it is actually being created.
– Italo Rodrigo
I already did that, the id value is not going null.
– Alysson bormann