views:

39

answers:

2

I followed the http://haacked.com/archive/2010/04/15/sending-json-to-an-asp-net-mvc-action-method-argument.aspx blog on how to setup binding json data to a ViewModel. seems to work.

The problem is that it is super slow. A collection with 200 entries in it and 8 fields per entry takes 3 minutes to even reach a break point at the beginning of controller. Just 1 or 2 entries take very little time. The only thing I know of that is happening between submit and reaching the controller is data binding to the ViewModel. I don't know if MVC2 provides a good way to send this much data and bind it. I also suspect using x-forms data, instead of json, and creating custom binders would run me into the same problem. Any Ideas?

A: 

I would try submitting your json to the controller action as a single string and then deal with parsing json explicitly in your own code... and skip model binding all together...

Scrappydog
I just loose all the built in MVC2 stuff. But maybe that is just what it is? At this point I don't see the benefits of MVC2. A restful application pretty much does the same thing.
Chris
A: 

I'm not sure if this helps anyone, but my binding issues seem to have been resolved. I'm not sure exactly what the problem was. I made a design change to minimize the problem (only sent changed data over the wire). This put off the problem. However, recently I had to implment something that does generate a lot of data that needs to be bound and I had no binding lag. So not sure what fixed it.

The only thing I can think of is that I found out that JSON variable casting is not necessary in the request.

data={"pkid":"86"} as opposed to data={"pkid":86}

Actually casting the JSON was causing problem with some data types and so now I use all strings in the request, which so far MVC2 bind very well.

So I'm not sure if this fixed the huge binding lag or if some other application/Server configuration fixed it. If anyone has this problem try it out and confirm.

Chris