-
Nov 22nd, 2012, 10:05 PM
#1
Thread Starter
Addicted Member
Entity Framework
I've instantiated a new Users entity and attached an new Avatars entity to it. The primary and foreign key in the Avatar table is UserID and the primary key in the user table is UserID.
When I try to save the Users entity object I get an error message saying that the UserID column in the Avatar table cannot be Null. The entity framework, apparently, is not creating a new UserID in the Users table and Avatars table in the same save statement.
The code works if i save the users object first and then retrieve the userID and then save the avatar seperately but this seems quite long winded to me. Is there any way to make these changes in one go?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|