首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

简单Linq有关问题,OData查询的 进来结贴给分 ~

2013-11-29 
简单Linq问题,OData查询的进来结贴给分 在线等 ~~~~!![HttpGet]public PageResultCompensatePlan GetCom

简单Linq问题,OData查询的 进来结贴给分 在线等 ~~~~!!
        [HttpGet]
        public PageResult<CompensatePlan> GetCompensatePlanAll(ODataQueryOptions<CompensatePlan> queryOptions)
        {
            var facade = new CompensateFacade();
            var query = facade.GetCompensatePlan();
            IQueryable results = queryOptions.ApplyTo(query);
            return new PageResult<CompensatePlan>(results as IQueryable<CompensatePlan>, Request.GetNextPageLink(),
                                              Request.GetInlineCount());
        }

CompensatePlan实体类有一个字段为DiagnosisDate  是DateTime的类型,我在OData查询中传入
api/GetAll?$filter=DiagnosisDate ge 2013-01-01   //为什么报错?
我传入:
api/GetAll?$filter=ID ge 1 结果正常。
[解决办法]
DiagnosisDate ge datetime'2013-01-01'

你的问题和LINQ没有关系,是传参时的语法问题,参考:
http://stackoverflow.com/questions/12865376/tridion-odata-query-with-datetime-filter-error-datetime-is-not-property-of-e

热点排行