I am a relative newby to EF and have created a simple model (see below) using EF4.
I am having a p
Your UserDetail
object should have a property that links back to the UserRecord
object. (It is maybe called User
? If I'm reading the navigation section below correctly.) If you set that property to your new, uncommitted UserRecord
object, it will automatically fill in the key when it commits both objects.
UserRecord userRecord = new UserRecord();
// whatever
UserDetail userDetail = new UserDetail();
userDetail.User = userRecord; // This will auto-fill the FK during commit.
// whatever
// Add both userRecord and userDetail to the context and commit.