The feedback for my last Ajax.NET Wrapper DLL was very good. I got a lot of new ideas, thank you!!
Now, I changed the javascript that will be created with the wrapper. It will be a little bit smaller, but there will be more changes to save more bytes in the future.
On thing the users asked for was to return System.Data.DataSets or DataTables to the client. I have done my first sample and I am very happy to present the next release that will return DataSets and DataTables as a Javascript object. The syntax will be nearly the same as in .NET. I have added some code to the sample project at http://ajax.schwarz-interactive.de/csharpsample/ [1]. Feel free to play around, have a look inside the HTML/Javascript code and download the sample project and Ajax.NET Wrapper DLL [2]for free.
The second thing was to export any class. The first way was to mark the classes with attributes. Now, you do not have to mark these classes. Use your own .NET classes as you have done in the past.
The next missing feature was returning arrays. In the sample project I have added a method that will return a small class that will have a array. The C# code looks like this:
public class Address { public string Firstname = ""; public int Age = 0; }
public class MyClass { public DateTime TimeStamp = DateTime.MinValue; public Address[] Addresses = new Address[2]; }
The Javascript code is very similar to the code in .NET. Have a look at the callback function in Javascript:
alert(res.Addresses.length); alert(res.Addresses[0].Firstname);
Some users didn't know why to add a callback instead of calling the method direct. I have used callbacks to use the methods asynchron. If you call a method that will need some seconds until finished the browser will hang for this time!
You can also use the System.DateTime in your code!