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

                connections[this.type] = null;
                connection.Dispose();
            }
예제 #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();
     }
 }
예제 #7
0
 public void Dispose()
 {
     if (entities != null)
     {
         entities.Dispose();
     }
     if (entityConnection != null)
     {
         entityConnection.Dispose();
     }
 }
예제 #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();
        }
예제 #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();
            });
        }
예제 #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;
 }
예제 #12
0
 public virtual void Dispose()
 {
     _entityConnection.Dispose();
 }
예제 #13
0
파일: BaseData.cs 프로젝트: deancox9/ETL
 public virtual void Dispose()
 {
     dataContext.Dispose();
     entConn.Dispose();
 }