我有以下代码脚本:
using (var context = new DatabaseContext())
{
var records = context.GetData();
}
我需要在调用context.GetData()之前调整一些SQL Server“ SET STATEMENT ON | OFF”
using (var context = new DatabaseContext())
{
// EXAMPLE =======> SET DATEFORMAT dmy
context.?????? // How?
var records = context.GetData();
}
有可能吗?
答案 0 :(得分:2)
context.Database.ExecuteSqlCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");