Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Gallagher Jawvig

View GitHub Profile
@Jawvig
Jawvig / NoChangeTracking
Created Jun 14, 2014
Temporary disabling of change tracking in Entity Framework
View NoChangeTracking
public sealed class NoChangeTracking : IDisposable
{
private readonly DbContext _dbContext;
private readonly bool _initialAutoDetectChangesValue;
public NoChangeTracking(DbContext dbContext)
{
if (dbContext == null) throw new ArgumentNullException("dbContext");
_dbContext = dbContext;
@Jawvig
Jawvig / BusinessLogic.cs
Last active Feb 24, 2017
Entity Framework tightened dependencies
View BusinessLogic.cs
public class Coordinator
{
private readonly ICompleteUnitOfWork _unitOfWorkCompleter;
private readonly WidgetGenerator _widgetGenerator;
private readonly WotsitGenerator _wotsitGenerator;
public Coordinator(
ICompleteUnitOfWork unitOfWorkCompleter,
WidgetGenerator widgetGenerator,
WotsitGenerator wotsitGenerator)
@Jawvig
Jawvig / BusinessLogic.cs
Last active Aug 29, 2015
Entity Framework whole context injection
View BusinessLogic.cs
public class Coordinator
{
private readonly IMyContext _myContext;
private readonly WidgetGenerator _widgetGenerator;
private readonly WotsitGenerator _wotsitGenerator;
public Coordinator(
IMyContext myContext,
WidgetGenerator widgetGenerator,
WotsitGenerator wotsitGenerator)