草庐IT

ExecuteStoreCommand

全部标签

c# - Entity Framework ——CreateQuery VS ExecuteFunction VS ExecuteStoreQuery VS ExecuteStoreCommand

以下有什么区别-CreateQuery() ExecuteFunction(),ExecuteStoreQuery()andExecuteStoreCommand()据我所知,CreateQuery用于实体SQL,其余方法用于DB中定义的sql函数或存储过程。根据ObjectContext类元数据,它们如下:CreateQuery():CreatesanSystem.Data.Objects.ObjectQueryinthecurrentobjectcontextbyusingthespecifiedquerystring.Returned->System.Data.Objects.O

c# - Entity Framework 5 中的 ExecuteStoreCommand 方法在哪里?

我在VS2012中使用EF5,我尝试使用ExecuteStoreCommand删除某个表的所有数据,像这样:ctx.ExecuteStoreCommand("TRUNCATETABLE["+tableName+"]");但问题是EF告诉我,找不到方法ExecuteStoreCommand。我不明白为什么?你能告诉我为什么吗?或者给我一个高效的解决方案来删除表中的所有数据。 最佳答案 试试这个:ctx.Database.ExecuteSqlCommand 关于c#-EntityFramew