本文教程为大家分享了显示数据表格(一种控件)控件的使用方法和具体实现代码,供大家参考,具体内容如下
模型文件下实体类:
公共类客户{公共int Id { get设置;}公共字符串CompanyName { get设置;}公共字符串ContactTitle { get设置;}公共字符串地址{ get设置;}公共字符串城市{ get设置;}公共字符串国家{ get设置;}公共字符串电话{ get设置;}公共日期时间已创建{ get设置;} }
公共类CustomersViewModel { public IQueryableCustomer Customers { get;设置;} public PagingInfo PagingInfo { get设置;}公共字符串JsonPagingInfo { get设置;} }公共静态类ExpresssionBuilder {私有静态只读方法信息包含方法=的类型(字符串)。GetMethod('包含');私有静态只读方法信息startsWithMethod=的类型(字符串)。GetMethod(' start with ',新类型[] { typeof(字符串)});私有静态只读方法信息endsWithMethod=的类型(字符串)。GetMethod('EndsWith ',新类型[] { typeof(字符串)});公共静态表达式FuncT,bool get expression ont(ilist filtererrobject filters){ if(filters .计数==0)返回空参数表达式参数=表达式。参数(类型为(T),' T ');表达式exp=nullif(滤波器count==1)exp=GetExpressont(param,filters[0]);否则如果(筛选器count==2)exp=getexpressont(param,filters[0],filters[1]);else { while(筛选器。计数0){ var f1=filters[0];var f2=滤波器[1];if(exp==null)exp=getexpressont(param,filters[0],filters[1]);else exp=表达式AndAlso(exp,getexpressont(param,filters[0],filters[1]);过滤器。移除(f1);过滤器。移除(F2);如果(滤波器计数==1) { exp=表达式.AndAlso(exp,getexpressont(param,filters[0]);过滤器在(0)处移除;} } }返回表达式LambdaFuncT,bool(exp,param);}私有静态表达式获取表达式ont(参数表达式参数,过滤器对象过滤器){成员表达式成员=表达式.属性(参数,过滤器。列);//ConstantExpress