If defined return type as IQueryable
then my ajax call fail some time.
[HttpGet]
public IQueryable<Banner> GetBannerForExcel()
{
return this._banneruow.Repository.GetAll();
}
I am getting 500 Internal Server Error and unable to debug also;
XML Parsing Error: no element found Location: moz-nullprincipal:{4acaf0ef-4230-404d-ae26-304916e1c044} Line Number 1, Column 1:
So when I use return type List<Banner>
it works perfect without error.
If your controller returns OData format, the response body from your action that returns IQueryable will contain more information such as next page of data, odata metadata. IQueryable supports further filtering, paging, but it doesn't support random access via indexer. List supports random access via indexer and doesn't support further filtering. In your case if you need only data on the client side then return List or IEnumerable.
IQueryable is better choice for data-tier (server side), because it defer execution.
I also would recommend you to trace what you are getting back from a server when you use IQueryable and List using browser dev tools, or Fiddler
You can find more information here:
IQueryable, IEnumerable or List
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加