/// <summary> /// 设置跳过行数 /// </summary> /// <param name="count">跳过的行数</param> public ISqlBuilder Skip(int count) { var param = GetOffsetParam(); ParameterManager.Add(param, count); return(this); }
/// <summary> /// 设置获取行数 /// </summary> /// <param name="count">获取的行数</param> public ISqlBuilder Take(int count) { var param = GetLimitParam(); ParameterManager.Add(param, count); Pager.PageSize = count; return(this); }
/// <summary> /// 获取限制行数的参数名 /// </summary> protected string GetLimitParam() { if (string.IsNullOrWhiteSpace(LimitParam) == false) { return(LimitParam); } LimitParam = ParameterManager.GenerateName(); return(LimitParam); }
/// <summary> /// 获取跳过行数的参数名 /// </summary> protected string GetOffsetParam() { if (string.IsNullOrWhiteSpace(OffsetParam) == false) { return(OffsetParam); } OffsetParam = ParameterManager.GenerateName(); ParameterManager.Add(OffsetParam, 0); return(OffsetParam); }
/// <summary> /// 获取参数 /// </summary> public IReadOnlyDictionary <string, object> GetParams() { return(ParameterManager.GetParams()); }
/// <summary> /// 添加参数 /// </summary> /// <param name="name">参数名</param> /// <param name="value">参数值</param> public void AddParam(string name, object value) { ParameterManager.Add(name, value); }
/// <summary> /// 添加参数 /// </summary> /// <param name="name">参数名</param> /// <param name="value">参数值</param> public ISqlBuilder AddParam(string name, object value) { ParameterManager.Add(name, value); return(this); }