LINQ update statement using generic table and column names -


ok, i've seen lot of posts on creating generic linq statements, these based on select queries. need linq update statement takes generic parameter table update , generic parameter column update.

the data model i'm working has dozens of tables, , each table has potentially dozens of columns. i'm driving toward single update statement allows me tell @ runtime table , column update.

dealing data typing of these dynamically supplied fields issue since can't update datetime column decimal value example.

so, can point me @ code shows linq update process using generic parameters table , column names.

any appreciated!

you didn't specify entity framework dbcontext if using, pretty easy. following code written work within nerddinner sample can downloaded http://nerddinner.codeplex.com/

this code locates dinner based on id , sets address property "new value"

        dinner dinner = db.set<dinner>().find(id);          var entry = db.entry(dinner);         entry.property("address").currentvalue = "new value";          db.savechanges(); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -