My setup is this; first I'm defining a couple of new rows.
newCompany = new company
{
companyInfo = value.company_info,
companyName = value.company_name,
organizationNumber = value.company_orgnr
};
newContract = new contract
{
contractName = value.contract_name
};
Then I define a new row in the contractToCompany table:
contracttocompany newContractToCompany = new contracttocompany { company_idCompany = newCompany.idCompany, contract_idContract = newContract.idContract };
And then I save changes
context.SaveChanges();
I have autoincrementing id-columns on all tables. Is this the right order to do things or will newContract.id and newCompany.id == default or null?