Example #1
0
 public Repository(RestaurantContainer db)
 {
     if (db == null)
     {
         this.db = new RestaurantContainer();
     }
     _disposed = false;
     //SERIALIZE WILL FAIL WITH PROXIED ENTITIES
     //dbContext.Configuration.ProxyCreationEnabled = false;
     //ENABLING COULD CAUSE ENDLESS LOOPS AND PERFORMANCE PROBLEMS
     //dbContext.Configuration.LazyLoadingEnabled = false;
 }
Example #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             if (db != null)
             {
                 db.Dispose();
             }
         }
         db        = null;
         _disposed = true;
     }
 }