ORM中一个很重要的方法BuildConditionSetSql

///<summary>

///根据查询条件集合生成Sql语句与Sql参数

///<summary>

protected System.String BuildConditionSetSql(ConditionSet conditionSet,IList outputParams)

{

  List<System.String> conditions=new List<System.String>();

  foreach(Condition subCondition in conditionSet.SubConditions)

  {

    System.String str=BuildConditionSql(subCondition,outputParams);

    if(!System.String.IsNullOrEmpty(str)) conditions.Add(str);

  }

  if(conditions.Count==0) return null;

  return "("+System.String.Join(" "+conditionSet.JoinType+" ",conditions.ToArray())+")"

}

你可能感兴趣的:(Condition)