public void Dispose()
 {
     if (_connection != null)
     {
         _connection.Dispose();
     }
 }
Exemple #2
0
            void IDisposable.Dispose()
            {
                EntityConnection connection = connections[this.type];

                connections[this.type] = null;
                connection.Dispose();
            }
Exemple #3
0
            void IDisposable.Dispose()
            {
                EntityConnection connection = connections[this.type];

                // restore cached connection - null is fine and means that connection has to be recreated
                connections[this.type] = cachedConnection;
                connection.Dispose();
            }
 private static bool IsServerConnected(string connectionString)
 {
     using var connection = new EntityConnection(connectionString);
     try
     {
         connection.Open();
         connection.Close();
         connection.Dispose();
         return(true);
     }
     catch (EntityException)
     {
         connection.Close();
         connection.Dispose();
         return(false);
     }
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing && _entityConnection != null)
     {
         _entityConnection.Dispose();
     }
 }
Exemple #7
0
 public void Dispose()
 {
     if (entities != null)
     {
         entities.Dispose();
     }
     if (entityConnection != null)
     {
         entityConnection.Dispose();
     }
 }
Exemple #8
0
        /// <summary>
        /// 初始化AppRoot
        /// </summary>
        public static void Inital()
        {
            //模型对象初始化
            instance = null;
            instance = new AppRoot();

            //连接初始化
            if (connection != null)
            {
                connection.Dispose();
            }
            connection = new EntityConnection(Helper.CreateConnectString());
            connection.Open();
        }
        public override void TearDownSample()
        {
            if (context != null)
            {
                context.Dispose();
                context = null;
            }

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

            base.TearDownSample();
        }
Exemple #10
0
        /// <summary>
        /// 初始化AppRoot
        /// </summary>
        public static void Inital()
        {
            //模型对象初始化
            instance = null;
            instance = new AppRoot();

            //连接初始化
            ThreadPool.QueueUserWorkItem(delegate
            {
                if (connection != null)
                {
                    connection.Dispose();
                }
                connection = new EntityConnection(Helper.CreateConnectString());
                connection.Open();
            });
        }
Exemple #11
0
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposed)
     {
         if (disposing)
         {
             if (_connection != null)
             {
                 _connection.Dispose();
                 _connection = null;
             }
             if (_entityConnection != null)
             {
                 _entityConnection.Dispose();
                 _entityConnection = null;
             }
         }
     }
     _disposed = true;
 }
 public virtual void Dispose()
 {
     _entityConnection.Dispose();
 }
Exemple #13
0
 public virtual void Dispose()
 {
     dataContext.Dispose();
     entConn.Dispose();
 }