/// <summary> /// Ensure the Data Context is cleaned up /// </summary> public void Dispose() { if (_context != null) { _context.Dispose(); _context = null; } }
public BaseAccessor(string user) { _user = user; _context = new CharonContext(); _context.Configuration.LazyLoadingEnabled = false; _context.Configuration.ProxyCreationEnabled = false; //true is the default, but I've added an explicit assignment anyway _context.Configuration.AutoDetectChangesEnabled = true; }
/// <summary> /// Sort of like a copy constructor where we reuse an existing DbContext with a new Data Accessor class /// </summary> /// <param name="access">An existing DbContext</param> internal DataAccessor(CharonContext access, string user) : base(user) { DataContext = access; }