Where is the ExecuteStoreCommand method in Entity Framework 5?

杀马特。学长 韩版系。学妹 提交于 2019-12-09 08:04:04

问题


I'm using EF5 in VS2012, and I trying to delete all data of some table using ExecuteStoreCommand, something like this:

ctx.ExecuteStoreCommand("TRUNCATE TABLE [" + tableName + "]");

but the problem is EF is telling me, method ExecuteStoreCommand not found. I can't understand why?

Can you tell me why?, or give me a performant solution remove all data of the table.


回答1:


Try this:

ctx.Database.ExecuteSqlCommand


来源:https://stackoverflow.com/questions/13857242/where-is-the-executestorecommand-method-in-entity-framework-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!