Пример #1
0
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="table"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        private bool Exists <T>(Table table, T entity)
            where T : Entity
        {
            WhereClip where = DataUtils.GetPkWhere <T>(table, entity);
            FromSection <T> fs = new FromSection <T>(dbProvider, dbTrans, table);

            return(fs.Where(where).Count() > 0);
        }
Пример #2
0
        /// <summary>
        /// 判断记录是否存在
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="table"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        private bool Exists <T>(Table table, WhereClip where)
            where T : Entity
        {
            if (where == null || where == WhereClip.None)
            {
                throw new DataException("在判断记录是否存在时出现异常,条件为null或WhereClip.None!");
            }

            FromSection <T> fs = new FromSection <T>(dbProvider, dbTrans, table, null);

            return(fs.Where(where).Count() > 0);
        }
Пример #3
0
 /// <summary>
 /// 进行条件操作
 /// </summary>
 /// <param name="where"></param>
 /// <returns></returns>
 public TableRelation <T> Where(WhereClip where)
 {
     section.Where(where);
     return(this);
 }