INTRODUCTION
Install-Package EntityFramework.InterceptorEx
static DbContextConstructor()
{
DbInterception.Add(new WithNoLockInterceptor());
}
WithNoLockInterceptor.Suppress = true;
string sql = WithNoLockInterceptor.CommandText
SELECT [Extent1].[BlogId] AS [BlogId], [Extent1].[Name] AS [Name]
FROM [dbo].[Blogs] AS [Extent1] WITH (NOLOCK)
WHERE [Extent1].[Name] LIKE N'Lo%'
static DbContextConstructor()
{
DbInterception.Add(new WithTransactionInterceptor());
}
WithTransactionInterceptor.Suppress = true;
Sample Sql Query Output
DECLARE @errorCode INT
BEGIN TRAN
SELECT [Extent1].[BlogId] AS [BlogId], [Extent1].[Name] AS [Name]
FROM [dbo].[Blogs] AS [Extent1] WITH (NOLOCK)
WHERE [Extent1].[Name] LIKE N'Lo%'
SELECT
@errorCode = @@ERROR
IF (@errorCode <> 0) GOTO ERR_HANDLE_BLOCK
COMMIT TRAN
ERR_HANDLE_BLOCK: IF (@errorCode <> 0) BEGIN
ROLLBACK TRAN
END
If you encounter a bug, performance issue, or malfunction, please add an Issue with steps on how to reproduce the problem.
- Add more tests
- Add more documentation
Code and documentation are available according to the MIT License (see LICENSE).