using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
public class ItemsController : ApiController
{
...
[HttpGet]
[Queryable]
public IQueryable<Item> GetItems()
{
return _repository.Items.AsQueryable();
}
ancak Visual Studio niteliği [Queryable] ekliyorum
bana
söyler tanınmadı bağlıyor'Queryable' is not an attribute"
ve ben bir derleme hatası alıyorum: Ben niteliği nitelikte ise
CS0616: 'System.Linq.Queryable' is not an attribute class
[System.Web.Http.Queryable]
başka hata mesajı
CS0234: The type or namespace name 'Queryable' does not exist in the namespace 'System.Web.Http' (are you missing an assembly reference?)
Herhangi fikir edinmek neden [Queryable] tanınacak görünmüyor? Bu, Web API'sinin daha sonraki bir tarihte eklendiği bir Web formları uygulamasıdır.
Bu şimdi kullanımdan kaldırılmıştır. Kullanın [EnableQuery] https://msdn.microsoft.com/en-us/library/system.web.http.odata.enablequeryattribute(v=vs.118).aspx –
Burada nasıl kullanılacağı anlatılmaktadır: http : //www.drdobbs.com/windows/using-odata-from-aspnet/240168672 –