在调用Query

时间:2019-05-23 16:33:18

标签: c# sql-server entity-framework

我有以下代码脚本:

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();
}

有可能吗?

1 个答案:

答案 0 :(得分:2)

context.Database.ExecuteSqlCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");