views:

468

answers:

1

Heres a newb question for you.

I have a multi tier environment so i dont have the origional datacontext where the item was created, thus i am having an issue getting the table to update correctly - here is what im doing:

1.) Get the object from the DAL layer 2.) make changes 3.) call update on the DAL layer and pass the modified entity 4.) on the DAL layer where im trying to update:

var a = (p => p.ID == 3);
a = myPassedInEntity
myContext.Update();

if i inspect 'a' prior to calling update it has the values of the myPassedInEntity but saving just saves the old data.

Why is there no UpdateOnSubmit() like there is InsertOnSubmit() ?

+1  A: 

There's a couple options to fix your problems here - see the answers to this question or this one for more info. Basically your options are to use the Linq serialization so that it can cross DataContext boundaries, use a timestamp to track row versions, or update your properties one by one.

Scott Ivey