Пример #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="keyValue">主键Key,如果没有主键会报错</param>
        /// <returns></returns>
        public TEntity Find(object keyValue)
        {
            Expression <Func <TEntity, bool> > predicate = PredicateBuilds.BuildPredicate <TEntity>(keyValue);
            var q = new Query <TEntity>(this.DbContext).Where(predicate);

            return(q.FirstOrDefault());
        }
Пример #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="keyValue">主键Key,如果没有主键会报错</param>
        /// <returns></returns>
        public int Remove(object keyValue)
        {
            Expression <Func <TEntity, bool> > predicate = PredicateBuilds.BuildPredicate <TEntity>(keyValue);

            return(Remove(predicate));
        }