Also, I've just added a Name property to the attributes. So, you can alias methods / actions in your code. (I can see this as being very useful if someone were switching between platforms and you didn't want to / couldn't rename all of your methods to match.)

@durlabh: I think this thread must continue as intended, namely a central thread for comments, questions, and improvements regarding Evan's Ext.Direct .NET Router. I appreciate your ExtJs related initiatives but please do not use this thread as a 'promotional platform' for your version.

Ok, I've attached my version of the code. I looked around at the latest version, but I think the differences were things that I had modified in my code (in a slightly different way.) If I missed something, please let me know and I'll update my code.

Some highlights: (any line numbers are from my code)

1. I've done a little bit of cleaning up in the logic of DirectProcessor around line 58 just to make it more concise.

2. I've changed out how the JSON is created by using the DefaultValueHandling property on JsonSerializerSettings. (See this thread here on JSON.Net board - it was a feature I implemented, then James modified a year or so ago.) This, combined with [DefaultValue] attributes added to JsonResponse makes the JSON more concise. If an event is sent back, then you don't get the other unnecessary null fields. (DirectProcessor line 60 and attributes in DirectResponse)

3. I've added DirectEvent, which can be passed back by an action/method to invoke a clientside event in Ext.Direct.

4. I've modified DirectResponse to recognize an exception or an event and to send different response types down to the client. (DirectResponse line 14)

5. I've modified DirectProcessor.ProcessRequest to be able to handle the return of a List<object> from the method, and to create a List<DirectResponse> that it passes back to be serialized. This allows events AND data to be sent down to the client at the same time. (Though caution has to be taken due to how events are ran by Ext.Direct.) (DirectProcessor line 77)

6. I've modified ProcessRequest to catch and handle exceptions. Instead of just handing DirectExceptions like your code does, I handle ALL exceptions, but I've wrapped the try catch in a Preprocessor directive so that the IDE will still catch on errors while in debug mode. You can put it in Release mode to have the errors sent only to the client. (This needs finished to not send down callstack when in Release mode.) (DirectProcessor Line 72)

I think that's it, but you can see why it was easier to just attach my code instead of trying to describe patches. Take a look and let me know what's good / bad. I'd be happy to help integrate these into your code, or vice versa.

would map the clientside myAction.myMethod() to the server side YourAction.YourMethod(). Useful if you really do decide to change your server back end, or having naming conflicts between client side objects and server side objects. I personally use it so that I can name all of my Direct Action classes as "ObjectController" without having to call "ObjectController" on the clientside.

anyway, the previous post had a bug, so I'm updating the code in that post to fix the bug.

I have another version of the library now that will pass back the "enableBuffer" property on methods that I propose in this other thread.

I don't want to post it up yet because I don't want to muddy the waters between official ext and the ux I'm using for adding this feature to Ext.Direct. But if someone wants it, let me know. The change is pretty straight forward, just add a new property to DirectMethod called enable buffering, and make it render to the json, then use it when you use the DirectMethod attribute when needed.

I would also suggest adding "enableBuffer" at the Provider level so that it conforms with the Ext.Direct interface.

Direct methods not working with directFn & baseParams

I am using the Router 0.6 and can get it to work by calling a Direct method from my Javascript code, but when I try to use it to populate a combobox specifying a directFn and baseParams, request.Data in DirectProcessor.ProcessRequest ends up looking like this:

{object[1]}
[0]: {object}

I get the following error:
Error occurred while calling Direct method: Object of type 'System.Object' cannot be converted to type 'System.String'

It doesn't seem to matter what I put in the baseParams--I'd like to send more than one parameter. Can anyone help me?

It deserializes the JSON object into an {object}, but I'm not sure how to cast that into something usable.

I just tried using durlabh's alternate Ext.Direct .Net implementation (http://extjs.com/forum/showthread.php?t=75311) which uses Microsoft's JavaScript serialization. It deserializes the JSON object into an object that can be cast into a Dictionary<string, object> type.