gimmi/extdirecthandler

Add options for camelCase/PascalCase property and method names

schiffm opened this issue · 2 comments

Currently, PascalCase method names in C# are being mapped to camelCase JavaScript method names by using a helper function, pascalizeName, in the ReflectionConfigurator. Similarly, PascalCase property names in C# objects are being mapped to camelCase property names in the returned JSON by use of the CamelCasePropertyNamesContractResolver of the Newtonsoft.Json library.

I'd like to request that there be options to change or preserve the case of properties and methods. I have a large project that was using a different Ext.Direct implementation, which did not change any cases. It would be a huge task to change the case of all properties and methods throughout the JavaScript to be able to use ExtDirectHandler.

You can customize ALL aspects of JSON serialization by following the example in this wiki page:

https://github.com/gimmi/extdirecthandler/wiki/JSON-serialization-customization

For the naming of published methods, ExtDirectHandler support pluggable metadata provider (classes that implements IMetadata and act as provider of Action/Method definitions). Out of the box you have 2 metadata providrs:

  • ReflectionConfigurator that discover published methods and publish with a camelCase.
  • LambdaConfigurator for greater control on which/how methods are published

If this is not enought, you can propose a pull request with the changes in ReflectionConfigurator that you wish integrate, and i will be appy to consider it

This is resolved in version Version 0.8.10 through pull # 11. Thanks!