Last post Apr 22, 2015 09:49 AM by Guiqi
Apr 22, 2015 09:35 AM|Guiqi|LINK
In EF 6，I can directly execute stored procedures using the ExecuteCommand method,For example:
var data = new AdventureDataContext();
data.ExecuteCommand("ResetOrders");But Now, I use EF7.0,I cann't find the ExecuteCommand，EF 7 does't support this ?
Apr 22, 2015 09:42 AM|Lokesh B R|LINK
Stored Procedure support not yet implemented in EF7.
You can do as follows.
var connection = (SqlConnection)context.Database.AsSqlServer().Connection.DbConnection;
var command = connection.CreateCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "ResetOrders";
Apr 22, 2015 09:49 AM|Guiqi|LINK
Thanks a lot