views:

25

answers:

1

I have a code sample like this



using (MyContainer container = new MyContainer (connectionString))
{
   container.ContextOptions.ProxyCreationEnabled = false;
   IQueryable users = from user in container.Users
                            where user.UserName == myuserName
                            select user;
    User claimUser = users.SingleOrDefault();
    claimUser.Preferences.Add( new Preference ....);
    container.SaveChanges();

in the mapping ' inserts/updates/deletes are mapped to stored procs.

the problem is that even though i am only adding to the preference collection here, it calls the proc for updating user, and then calls proc for inserting preference.

shouldnt it just call inserting preference proc ? since user entity didnt really change ?

A: 

You don't seem to be calling DetectChanges.

Craig Stuntz