protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
Beispiel #2
0
        public static void ConfigureDatabase()
        {
            var installer = new SqlCEInstaller(new SqlCEHelper(ConnectionString));

            if (installer.CanConnect)
            {
                UmbracoDatabase umbracoDatabase = new UmbracoDatabase(ConnectionString, ProviderName);
                umbracoDatabase.CreateDatabaseSchema();
                umbracoDatabase.Dispose();
            }
        }
 protected override void DisposeResources()
 {
     if (HttpContext.Current == null)
     {
         _nonHttpInstance.Dispose();
     }
     else
     {
         if (HttpContext.Current.Items.Contains(typeof(DefaultDatabaseFactory)))
         {
             ((UmbracoDatabase)HttpContext.Current.Items[typeof(DefaultDatabaseFactory)]).Dispose();
         }
     }
 }
Beispiel #4
0
        private void DisposeLastScope()
        {
            // figure out completed
            var completed = _completed.HasValue && _completed.Value;

            // deal with database
            var databaseException = false;

            if (_database != null)
            {
                try
                {
                    if (completed)
                    {
                        _database.CompleteTransaction();
                    }
                    else
                    {
                        _database.AbortTransaction();
                    }
                }
                catch
                {
                    databaseException = true;
                    throw;
                }
                finally
                {
                    _database.Dispose();
                    _database = null;

                    if (databaseException)
                    {
                        RobustExit(false, true);
                    }
                }
            }

            RobustExit(completed, false);
        }
        public void Dispose()
        {
            EnsureNotDisposed();

            if (this != _scopeProvider.AmbientScope)
            {
                throw new InvalidOperationException("Not the ambient scope.");
            }

#if DEBUG_SCOPES
            _scopeProvider.Disposed(this);
#endif

            if (_database != null)
            {
                _database.Dispose();
            }

            _scopeProvider.SetAmbient(null);

            _disposed = true;
            GC.SuppressFinalize(this);
        }
Beispiel #6
0
 public void Dispose()
 {
     umbracoDatabase.Dispose();
 }
 protected override void DisposeResources()
 {
     _db.Dispose();
 }
Beispiel #8
0
 public void Teardown()
 {
     _database.Dispose();
 }