Esempio n. 1
0
 /// <summary>
 /// Ensure the Data Context is cleaned up
 /// </summary>
 public void Dispose()
 {
     if (_context != null)
     {
         _context.Dispose();
         _context = null;
     }
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 /// <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;
 }