Skip to content

enisgurkann/ENLOCK

Repository files navigation

ENLOCK - EFCORE With(No Lock) Tool

GitHub GitHub Repo stars GitHub last commit Contributors Discussions Nuget version Nuget downloads

It is the plugin we made to simplify the 'transaction scope' event that we use to prevent the database lock event when using Entity Framework.

Methods

FirstOrDefault,Single,ToList,Any and Async

Efcore Provider Usage

PM> Install-Package ENLOCK
PM> Standart FirstOrDefault
        var customer = await _context
        .Customers
        .Where(x => x.Name == 'Enis' && x.Surname == 'Gürkan')
        .FirstOrDefaultkAsync();
 
PM> Using ToFirstOrDefaultWithNoLockAsync
        var customer = await _context
        .Customers
        .Where(x => x.Name == 'Enis' && x.Surname == 'Gürkan')
        .ToFirstOrDefaultWithNoLockAsync();
 
PM> Using other expressions
        var customers = await _context.NoLock(s => s.Customers.ToListAsync());
 
PM> Using other expressions
        var customers = await _context.Customers.WithNoLock().ToListAsync();