I am trying to figure out if LinqConeect offers an alternate to modify an entity.
In linq to sql, when doing this with a disconnected entity
Code: Select all
context.Attach( entity, original )
will give me "Cannot add an entity with a key that is already in use."
if doing this
Code: Select all
context.Attach (entity, true )
To resolve it, the simplest way was to remove all UpdateCheck or do copy of properties from the modified entity to the in-context entity
However, I still need the concurrency check and I also don't want to do a manual copy because the entity has multiple children.
Another popular way in linq to sql is to detach the entity first, and then attach it back. Well, it has been 4 or 5 years, is there any better neat way now?
Also wondering if linqConnect offers a better alternate to achieve an update like this?
thanks