I have two entities: PersonEntity and CredentialsEntity which have a 1:1 relation between them.
When I want to create a new person with credentials, this is my code:
PersonEntity person = new PersonEntity();
person.Credentials = new CredentialsEntity();
person.Save(true);
When I reach the last line, a sqlexception is thrown because the referencing column in the credentials table, personId, can't be null.
How can I recursively add and save records with a 1:1 relation? I could first save the person and after that save the credentials with the proper personId, but I think it should be done using a recursive save.