public bool DeleteRange(IEnumerable <TEntity> entities)
        {
            bool res = false;

            using (var conn = new WrappedDbConnection(ConnectionFactory.GetDBConnecton(this._connectionString, this._dbAdapter)))
            {
                res = conn.Delete(entities);
                conn.Close();
            }
            return(res);
        }
        //
        // Get methods
        //

        public T GetValue <T>(string query)
        {
            T res;

            using (var conn = new WrappedDbConnection(ConnectionFactory.GetDBConnecton(this._connectionString, this._dbAdapter)))
            {
                res = conn.ExecuteScalar <T>(query);
                conn.Close();
            }
            return(res);
        }
        public long AddRange(IEnumerable <TEntity> entities)
        {
            long id = 0;

            using (var conn = new WrappedDbConnection(ConnectionFactory.GetDBConnecton(this._connectionString, this._dbAdapter)))
            {
                id = conn.Insert(entities);
                conn.Close();
            }
            return(id);
        }
        public long Add <T>(T entity) where T : class
        {
            long id = 0;

            using (var conn = new WrappedDbConnection(ConnectionFactory.GetDBConnecton(this._connectionString, this._dbAdapter)))
            {
                id = conn.Insert(entity);
                conn.Close();
            }
            return(id);
        }
        public bool Update <T>(T entity) where T : class
        {
            bool res;

            using (var conn = new WrappedDbConnection(ConnectionFactory.GetDBConnecton(this._connectionString, this._dbAdapter)))
            {
                res = conn.Update(entity);
                conn.Close();
            }
            return(res);
        }
        public List <T> GetAll <T>() where T : class
        {
            List <T> res = new List <T>();

            using (var conn = new WrappedDbConnection(ConnectionFactory.GetDBConnecton(this._connectionString, this._dbAdapter)))
            {
                res = conn.GetAll <T>().ToList();
                conn.Close();
            }
            return(res);
        }
        public TEntity Get(long id)
        {
            TEntity res;

            using (var conn = new WrappedDbConnection(ConnectionFactory.GetDBConnecton(this._connectionString, this._dbAdapter)))
            {
                res = conn.Get <TEntity>(id);
                conn.Close();
            }
            return(res);
        }