Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        //
        // 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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }