Entity Framework 在调用事务时是否默认在 ExecuteFunction 上处理事务?
Does Entity Framework handle transaction by default on ExecuteFunction while calling transactions?
ObjectContext.ExecuteFunction<GetStoredProcedure_Result>("StoredProcedure", parameter);
此代码是否自动涵盖交易(Entity Framework)?还是我也应该在存储过程中添加事务?
请提供任何链接。
在 EF6 中,每个存储过程调用都包含在 Transaction
中。但对于早期版本的 EF,它不会自动覆盖。您需要指定 TransactionScope
如下...
using (TransactionScope transaction = new TransactionScope())
{
//your code here
}
有关交易的更多信息,请关注 MSDN。
我认为这个 link and this link 可以帮助您。
ObjectContext.ExecuteFunction<GetStoredProcedure_Result>("StoredProcedure", parameter);
此代码是否自动涵盖交易(Entity Framework)?还是我也应该在存储过程中添加事务?
请提供任何链接。
在 EF6 中,每个存储过程调用都包含在 Transaction
中。但对于早期版本的 EF,它不会自动覆盖。您需要指定 TransactionScope
如下...
using (TransactionScope transaction = new TransactionScope())
{
//your code here
}
有关交易的更多信息,请关注 MSDN。
我认为这个 link and this link 可以帮助您。