public static SqlConnection GetSqlConnection()
        {
            IStorageContainer <SqlConnection> _container = DataContextStorageFactory <SqlConnection> .CreateStorageContainer();

            var _connection = _container.GetObject(key);

            if (_connection == null || _connection.State == System.Data.ConnectionState.Closed)
            {
                _connection = new SqlConnection(conStr);
                _connection.Open();
                _container.Store(key, _connection);
            }
            return(_connection);
        }
        public static SqlTransaction GetSqlTransaction()
        {
            IStorageContainer <SqlTransaction> _container = DataContextStorageFactory <SqlTransaction> .CreateStorageContainer();

            var tran = _container.GetObject(key);

            if (tran == null)
            {
                tran = SqlConnectionContextFactory.GetSqlConnection().BeginTransaction();
                _container.Store(key, tran);
            }

            return(tran);
        }