entity framework 4 - How do you execute custom SQL in EF CTP4 -
using entity framework cpt4 there way execute custom command or script?
for example:
_dbset.provider.execute("truncate table users"); fwiw; using in class setup unit tests , setup tables clean data.
try objectcontext.executestorecommand method.
executes arbitrary command directly against data source using existing connection.
calling executestorecommand method equivalent calling executenonquery method of dbcommand class.
some other information: tip 41 – how execute t-sql directly against database
with example executestorecommand:
// 10% inflation day! ctx.executestorecommand("update products set price = price * 1.1");
Comments
Post a Comment