Пример #1
0
        /// <summary>
        /// 设置跳过行数
        /// </summary>
        /// <param name="count">跳过的行数</param>
        public ISqlBuilder Skip(int count)
        {
            var param = GetOffsetParam();

            ParameterManager.Add(param, count);
            return(this);
        }
Пример #2
0
        /// <summary>
        /// 设置获取行数
        /// </summary>
        /// <param name="count">获取的行数</param>
        public ISqlBuilder Take(int count)
        {
            var param = GetLimitParam();

            ParameterManager.Add(param, count);
            Pager.PageSize = count;
            return(this);
        }
Пример #3
0
 /// <summary>
 /// 获取限制行数的参数名
 /// </summary>
 protected string GetLimitParam()
 {
     if (string.IsNullOrWhiteSpace(LimitParam) == false)
     {
         return(LimitParam);
     }
     LimitParam = ParameterManager.GenerateName();
     return(LimitParam);
 }
Пример #4
0
 /// <summary>
 /// 获取跳过行数的参数名
 /// </summary>
 protected string GetOffsetParam()
 {
     if (string.IsNullOrWhiteSpace(OffsetParam) == false)
     {
         return(OffsetParam);
     }
     OffsetParam = ParameterManager.GenerateName();
     ParameterManager.Add(OffsetParam, 0);
     return(OffsetParam);
 }
Пример #5
0
 /// <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;
 }
Пример #6
0
 /// <summary>
 /// 获取参数
 /// </summary>
 public IReadOnlyDictionary <string, object> GetParams() => ParameterManager.GetParams();
Пример #7
0
 /// <summary>
 /// 添加Sql参数
 /// </summary>
 /// <param name="name">参数名</param>
 /// <param name="value">参数值</param>
 public ISqlBuilder AddParam(string name, object value)
 {
     ParameterManager.Add(name, value);
     return(this);
 }