I am using EF 4, mapping all CUD operations for my entities using sprocs.
I have two tables, ADDRESS and PERSON. A PERSON can have multiple ADDRESS associated with them.
Here is the code I am running:
Person person = (from p in context.People
where p.PersonUID == 1
select p).FirstOrDefault();
Address address = (from a in context.Addresses
where a.AddressUID == 51
select a).FirstOrDefault();
address.AddressLn2 = "Test";
context.SaveChanges();
The Address being updated is associated with the Person I am retrieveing - although they are not explicitly linked in any way in the code. When the context.SaveChanges() executes not only does the Update sproc for my Address entity get fired (like you would expect), but so does the Update sproc for the Person entity - even though you can see there was no change made to the Person entity.
When I check the EntityState of both objects before the context.SaveChanges() call I see that my Address entity has an EntityState of "Modified" and my Person enity has an EntityState of "Unchanged".
Why is the Update sproc being called for the Person entity? Is there a setting of some sort that I can set to prevent this from happening?