I'm having this error when trying to save an entity.
"An exception was caught during the execution of an action query: Cannot insert the value NULL into column 'PartyID', table 'Funds.dbo.Telefono'; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."
Code:
PartyEntity party = new PartyEntity();
party = pAdministracionEntity.Party;
trn.Add(party);
trn.Add(party.Telefonos);
trn.Add(party.Direcciones);
trn.Add(party.ContactoElectronico);
party.Save();
party.Telefonos.SaveMulti();
party.Direcciones.SaveMulti();
party.ContactoElectronico.Save();
trn.Commit();
the problem is that the partyEntity has an autonumeric Id, in the database the field is marked as autonumeric, i don't know why when debugging i make save "party" and looking at the watch the field PartyID is = 0, and then the party.Telefonos.SaveMulti() fails because it doesn't have a PartyId.