Linq to Sql: Update Entity throug a new Object

Posted by Dänu on Stack Overflow See other posts from Stack Overflow or by Dänu
Published on 2010-06-01T20:10:20Z Indexed on 2010/06/01 20:13 UTC
Read the original article Hit count: 265

Filed under:
|
|
|

Hey Guys

I'd like to update an entity via linq, but since I edit the entity in a view after serializing it, I don't have direct access to the entity inside the data context. I could do it like this:

entity.property1 = obj.property1;
entity.property2 = obj.property2;
...

thats not cool... not cool at all.

Next thing I tried is to do it via .attach() like so:

context.Table.attach(entity, obj);

doesn't work either. So is there another option short of reflection?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET