/// <summary>
        /// 设置删除的条件
        /// </summary>
        /// <param name="where">The where.</param>
        /// <returns>DeleteSqlSection.</returns>
        /// <remarks>
        ///     <para>创建:Teddy</para>
        ///     <para>日期:2016-10-17</para>
        /// </remarks>
        public DeleteSqlSection Where(WhereClip where)
        {
            whereClip.And(where);

            return(this);
        }
 public SelectSqlSection <T> Having(WhereClip whereClip)
 {
     this.whereClip.SetHaving(whereClip);
     return(this);
 }
        /// <summary>
        /// 设置更新的条件
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns></returns>
        public UpdateSqlSection <T> Where(WhereClip where)
        {
            whereClip.And(where);

            return(this);
        }
 /// <summary>
 /// 设置查询的条件
 /// </summary>
 /// <param name="where">lambda表达式 如 : p=> p.Name =="2"  或者 p=> p.Name=="2" && p.ID ==1</param>
 /// <returns></returns>
 public SelectSqlSection <T> Where(WhereClip where)
 {
     whereClip.And(where);
     return(this);
 }
Пример #5
0
 /// <summary>
 /// 设置关系
 /// </summary>
 /// <param name="parentTable">父级表</param>
 /// <param name="joinWhere">连接条件</param>
 /// <param name="propertyName">属性名称</param>
 /// <remarks>
 ///     <para>创建:jason</para>
 ///     <para>日期:2016-11-10</para>
 /// </remarks>
 public void SetRelation(TableSchema parentTable, WhereClip joinWhere, string propertyName)
 {
     this.parentTable  = parentTable;
     this.JoinWhere    = joinWhere;
     this.propertyName = propertyName;
 }
Пример #6
0
 /// <summary>
 /// 符合条件的数据总数
 /// </summary>
 /// <param name="whereExp">lambda表达式 如 : p=> p.Name =="2"  或者 p=> p.Name=="2" && p.ID ==1</param>
 /// <returns></returns>
 /// <remarks>
 ///    [QueryTable].Count(p => p.Name ==2);
 /// </remarks>
 public int Count(WhereClip whereExp)
 {
     return(new SelectSqlSection <T, TSchema>(dataContext, Schema, Schema.Count).Where(whereExp).GetTotalForPaging());
 }
Пример #7
0
        /// <summary>
        /// 表的数据总数
        /// </summary>
        /// <returns></returns>
        public int Count()
        {
            WhereClip whereExp = null;

            return(Count(whereExp));
        }
Пример #8
0
 /// <summary>
 ///删除指定条件的数据
 /// </summary>
 /// <param name="where">删除条件 p => p.Name ==1 && p.ID ==2 </param>
 /// <remarks>设置删除条件,设置事务
 /// [QueryTable].UpdateCustom(entity)
 ///             .Where(p => p.ID == 1).Execute();
 /// 事务的使用
 /// using(var tra == Context.BeginTransaction())
 /// {
 ///   try
 ///   {
 ///     [QueryTable].UpdateCustom()
 ///             .Set(p =>p.Name,  "10")
 ///             .Set(p =>p.Type,  "10")
 ///             .Where(p => p.ID == 1).SetTransaction(tra);
 ///
 ///     [QueryTable].DeleteCustom()
 ///             .Where(p => p.ID == 1).SetTransaction(tra);
 ///
 ///     tra.Commit();
 ///   }
 ///   catch
 ///   {
 ///     tra.Rollback();
 ///   }
 ///
 /// }
 /// </remarks>
 public DeleteSqlSection <TSchema> DeleteCustom(WhereClip where)
 {
     return(new DeleteSqlSection <TSchema>(dataContext, Schema).Where(where));
 }