实体框架:希望在不调用SaveChanges()的情况下生成SQL

时间:2014-12-13 21:43:51

标签: sql entity-framework

我想获取Entity Framework生成的SQL但不调用SaveChanges方法。我不喜欢用拦截器做这个,因为这给我带来了例外。

public void NonQueryExecuting(System.Data.Common.DbCommand command,DbCommandInterceptionContext interceptionContext)         {             SQLsRepository.Instance.Add(命令,executionId.Value);

        if (!interceptionContext.IsExecutionSuppressed)
        {
            interceptionContext.Result = -1;
            interceptionContext.SuppressExecution();
        }
    }

任何?

感谢。

hagai

0 个答案:

没有答案