I have a user table. there are references to this table from other tables for fields such as CreatedBy.
Problem is, when I am inserting a row of another table (say ‘x’), it tries to insert a new user into the user table.
What it should be doing is insert a row into table ‘x’ with CreatedBy as the existing user.
Using Entity Framework 4. Anyone faced a problem like that before?
You can insert an entity together with related entities or you can insert an entity without the related entities, just referencing existing ones. It depends on the code you write.
Example 1:
Example 2:
Example 3:
Edit
Example 4: