/// <summary> /// 配置查询的缺省参数设置 /// </summary> /// <modelExp name="setting"></modelExp> public static void Configure(DefaultQuerySettings setting) { if (setting == null) { throw new ArgumentNullException("setting"); } if (string.IsNullOrEmpty(setting.PageSizeName)) { throw new ArgumentNullException("setting.PageSizeName"); } if (string.IsNullOrEmpty(setting.PageIndexName)) { throw new ArgumentNullException("setting.PageIndexName"); } if (string.IsNullOrEmpty(setting.SortPropertyName)) { throw new ArgumentNullException("setting.SortPropertyName"); } if (string.IsNullOrEmpty(setting.SortOrderName)) { throw new ArgumentNullException("setting.SortOrderName"); } if (string.IsNullOrEmpty(setting.AscendingValue)) { throw new ArgumentNullException("setting.AscendingValue"); } if (string.IsNullOrEmpty(setting.DescendingValue)) { throw new ArgumentNullException("setting.DescendingValue"); } if (setting.PageSize == 0) { throw new ArgumentException("setting.PageSize 必须大于0"); } var binder = new QueryContextBinder(setting); ModelBinders.RegisterBinder <QueryContext, QueryContextBinder>(binder); }
/// <summary> /// 构造函数 /// </summary> internal QueryContextBinder(DefaultQuerySettings setting) { Setting = setting; }