Пример #1
0
        IEnumerator IEnumerable.GetEnumerator()
        {
            string             url   = PostHelper.BuildUrl(_criteria);
            IEnumerable <Post> posts = PostHelper.PerformWebQueryAsync(url).Result;

            return(posts.GetEnumerator());
        }
        public override object Execute(Expression expression)
        {
            string             url  = this.GetQueryText(expression);
            IEnumerable <Post> post = PostHelper.PerformWebQueryAsync(url).Result;

            return(post);
        }
        public override string GetQueryText(Expression expression)
        {
            SearchCriteria criteria;

            //翻译查询条件
            criteria = new PostExpressionVisitor().ProcessExpression(expression);

            //生成URL
            string url = PostHelper.BuildUrl(criteria, @"http://localhost/api/Cnblogs");

            return(url);
        }