/// <summary> /// 设置跳过行数 /// </summary> /// <param name="count">跳过的行数</param> /// <returns></returns> public ISqlBuilder Skip(int count) { var param = GetOffsetParam(); ParameterManager.Add(param, count); return(this); }
/// <summary> /// 设置获取行数 /// </summary> /// <param name="count">获取的行数</param> /// <returns></returns> 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> /// 初始化一个<see cref="ParameterManager"/>类型的实例 /// </summary> /// <param name="parameterManager">参数管理器</param> protected ParameterManager(ParameterManager parameterManager) { _params = new Dictionary <string, object>(parameterManager._params); _paramIndex = parameterManager._paramIndex; _dialect = parameterManager._dialect; }
/// <summary> /// 获取参数 /// </summary> /// <returns></returns> public IReadOnlyDictionary <string, object> GetParams() { return(ParameterManager.GetParams()); }
/// <summary> /// 添加Sql参数 /// </summary> /// <param name="name">参数名</param> /// <param name="value">参数值</param> public ISqlBuilder AddParam(string name, object value) { ParameterManager.Add(name, value); return(this); }
/// <summary> /// 获取参数 /// </summary> public IReadOnlyDictionary <string, object> GetParams() => ParameterManager.GetParams();
/// <summary> /// 添加Sql参数 /// </summary> /// <param name="name">参数名</param> /// <param name="value">参数值</param> public void AddParam(string name, object value) { ParameterManager.Add(name, value); }