Paging with OData vs regular parameter based paging - asp.net-web-api

For an application which doesn't require any other OData capabilities, where paging is implemented with parameters on controller, will it be right to include OData to use the paging features of it. If I understood concept wrong please educate me.

Related

Clarification of Web API in WebForm

I have created Web API.I know the Main advantage of Web API is cross domain application (I can call Web API in all platform). My question is ,Is there any performance issue When I call Web API in ASP.net WebForm???
I would like to know the below scenario
1.I Can use Direct SQL Query in .aspx Page
2.I Can use Web API and generate JSON to DataTable
I would like to know which one is fast and better to use.......
I have tried in JQuery,the performance is fine but I would like to call in ASP.net WEb Form
Where you call the API from or from what type of app makes no difference. Your issues are going to come from how you use it and what you do with the results of the calls.
Yes, you can get JSON data from the API and yes you can convert that to a DataTable, technically no issue there, but the performance will depend on how much data you retrieve in one go and how many transformations you go through to get it to the state you need for your webforms controls.
You're talking about using a dead tech ( webforms ) and trying to fit some things into how that works, which while possible, is not really the way to build anything these days.
SQL in aspx kinda says it all.Assuming you have an old app, that you just do updates to then just do what you can, but I would start looking into modern ways of building web apps. You don't have to keep using webforms controls anymore.
You can't talk about scalability when you still have stuff thrown in aspx pages. You need to start thinking about a proper separation of concerns, think about testing your stuff, retrieving only the data you need etc etc. Just because you add WebApi in the mix, that doesn't mean you'll get all the benefits, if everything else does not catch up to the required standard.
There is no inherent performance issue with using WebAPI, aside from the overhead of an additional network hop.
In real world terms, I think this would be negligible and outweighed by the benefits:
You get the 'cross platform' benefit you mentioned.
Better scalability as your 'service' and 'web' concerns are seperated and can be scaled appropriate to the load they need to serve.
The service layer functionality is re-useable, for example if you wanted to develop an app later.

why asp .net mvc web api does not support custom operations?

I don't know if I am missing something obvious.
I can see that asp .net web api supports standard Get(), GetById(), Add, Update, Delete operations. But it does not support some custom operations/actions like for example "Get_CustomDataForModel", "Do_SomePostWork" or "Do_somecalc_and_return_a_list" any such custom operations.
I have tried searching for this question, but couldn't get a direct answer. If this is a duplicate, pls give me the right link.
Is this because HTTP REST requests must only support one method each per url for GET, POST, DELETE, PUT etc.,?
Am I missing something obvious while it supports it and I don't see it?
Is there a way to add let's say 30 different actions with 15 get and 15 posts? (PS: I know having 30 actions inside a controller is a bad idea, but asking just for the sake of understanding)
By default, Web API supports HTTP method based routing. But it does support RPC-style routing based on action methods. Look at the section "Routing by Action Name" in http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-in-aspnet-web-api. BTW, it is possible to have 30 different action methods in a controller but won't it be a maintenance nightmare?

Filter JSON from ASP.Net handler | Using Dojo 1.8

Wanted to filter the results using Dojo 1.8 based upon the data received from server through a ASP.Net handler.
Handler Example - http://localhost/net/get8.ashx?longitude=-70.255325&latitude=43.661472&searchradius=200&searchunit=mi&locationtypes=3&numresults=20&Json=y
I could use (Store API) ItemFileReadStore but it's required specific format which we don't have and can't make the changes from the server end (JSON structure changes)
Able to successfully fetch the data through Dojo AJAX but looking for better way to filter the through some Dojo API.
One way around is, restructure the data again on client but it costs the performance and considering we developing for Mobile, doesn't look the right approach to take.
What all other options do we have in Dojo?
P.S. I just started learning Dojo Toolkit but having good experience in JavaScript.
The ItemFileReadStore has been replaced with the dojo/Store. You should be able to put the data into a dojo/store/Memory as is and query from that store.
http://dojotoolkit.org/reference-guide/1.8/dojo/store.html
http://dojotoolkit.org/reference-guide/1.8/dojo/store/Memory.html#dojo-store-memory
I already did use Object Store (Memory) to resolve the issue.

efficient paging with PetaPoco MVC3

Is there any way we could do efficient paging with petapoco and mvc3. At present i am pulling all the records which is certainly not a prefect way to do it.
It was very easy with using LINQ skip() take().
NOTE: this is going to be implemented in an auction portal and database would be massive.
Experts please shed some light.
There's an example of how you could do paged queries in the documentation. And here's the new API.

jqGrid filtering

I want to implement filtering in my jqGrid in my Spring Framework MVC 3.0 project. Where can I find sample code or documentation telling how to use filtering in this?
I just posted an answer on the same question (probably from you) on http://www.trirand.com/blog/?page_id=393/help/jqgrid-filtering. To make other people easy to read the answer I post the same information here.
The answer on your question depends a little how you interpret the "filtering". If you want use some external controls (selects, checkboxes and so on on the same page where you have jqGrid) to filter your data I recommend you to read How to filter the jqGrid data NOT using the built in search/filter box.
If you want to implement data filtering inside of jqGrid you can choose between serching with respect of "search" and reset of serching results with respect of "refresh" buttons of the navigator (simple searching and advanced searching), the usage of toolbar searching (conside the usage of stringResult: true to be more conform with other form of searching) and custom searching.
If you decide to use advance searching you can just add string filter parameter to the (see Guidance on a better way to retain filtering options when using ASP.NET MVC 2) action which provide the grid data or add three string parameters searchField, searchString, searchOper if you want to use simple searching feature. In all cases you will have to add WHERE to the SELECT statments which will be constructed in your program based on the values of the new parameters.
Probably other people post you more URLs to the good full code examples which you could use.
UPATED: I don't use Spring Framework myself, so I could not help you with any Spring MVC 3.0 examples. Some general solution is more common. For example in ASP.NET MVC solutions I prefer don't fill the data in the grid directly using MVC. Instead of that I provide a JSON web service (implemented as a part of ASP.NET MVC solutions or as WCFservice which are the part of the same web site) which URL I place in the jqGrid parameter. So you should just invest in the writing on business logic in form of JSON/XML web service which provide the data. The most jqGrid specific code you can write in JavaScript. So you can share the experience of other people in the usage of jqGrid and have a clear separation of HTML code from the business logic. Moreover JSON/XML web services can be better tested for example with respect of unit tests.

Resources