Skip to content

Instantly share code, notes, and snippets.

View Jawvig's full-sized avatar

Joshua Gallagher Jawvig

View GitHub Profile
@Jawvig
Jawvig / BusinessLogic.cs
Last active February 24, 2017 23:53
Entity Framework tightened dependencies
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 / NoChangeTracking
Created June 14, 2014 09:06
Temporary disabling of change tracking in Entity Framework
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 August 29, 2015 14:02
Entity Framework whole context injection
public class Coordinator
{
private readonly IMyContext _myContext;
private readonly WidgetGenerator _widgetGenerator;
private readonly WotsitGenerator _wotsitGenerator;
public Coordinator(
IMyContext myContext,
WidgetGenerator widgetGenerator,
WotsitGenerator wotsitGenerator)