Save entity with entity framework
Posted
by Michel
on Stack Overflow
See other posts from Stack Overflow
or by Michel
Published on 2010-04-03T17:43:24Z
Indexed on
2010/04/03
17:53 UTC
Read the original article
Hit count: 363
entity-framework
Hi,
I'm saving entities/records with the EF, but i'm curious if there is another way of doing it.
I receive a class from a MVC controller method, so basicly i have all the info: the class's properties, including the primary key. Without EF i would do a Sql update (update table set a=b, c=d where id = 5), but with EF i got no further than this:
Get an object with ID of 5 Update the (existing) object with the new object Submitchanges.
What bothers me is that i have to get the object from the database first, where i have all the info to do an update statement.
Is there another way of doing this?
© Stack Overflow or respective owner