예제 #1
0
        public bool Update(Expression <Func <T, dynamic> > fieldUpdate, Expression <Func <T, bool> > whereClause, object source)
        {
            IDbCommand cmd = connection.CreateCommand();

            cmd.CommandType = CommandType.Text;
            bool result = false;
            var  Query  = new UpdateQuery(Entity);

            cmd.CommandText = Query.GetQueryWithParameter(fieldUpdate, whereClause, source);
            Query.SetParameters(cmd);


            try
            {
                if (cmd.ExecuteNonQuery() > 0)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw new System.Exception(ex.Message);
            }
            return(result);
        }