Introducing DataTablesDotNet

The datatables plugin is one of the coolest jQuery plugins around, and I wanted to find a way to make it work easily with ASP.NET MVC sites. Initially I created some objects that included the various datatables property names and that worked well. However, when another project came along and I wanted to use datatables in that project too I realized the original way I created the objects just wasn’t going to cut it.

After a lot of searching I found this blog post. I liked what I saw. Even better was the additional code contributed by Paul Inglis in the comments. The only thing I did not like was the stringify used to turn the datatables JSON into key/value pairs. I also did not like the way the project was made available – a box.net download location with no way to contribute (hence the code in the comments). I decided I would build on these great contributions and update the code to work without the serialization.

So, here it is on GitHub. The code has been cleaned up, it uses Paul’s Expression code for building the filters/sorts, and it doesn’t stringify the datatables data which cuts the data sent pretty much in half. I also added a model binder so it all “just works”.

NOTE: Isn’t it funny how one can look for something and not see it right in front of them? When I was doing my original googling, I was getting next to nothing for results. It is funny how that can work out sometimes. I built upon the above codebase and pushed my code to GitHub and nuget because I thought I was providing something of value. It wasn’t until I searched for my nuget package that I saw about a dozen other packages doing similar things. That being said, there are only a couple that include everything I did – others are just models or binders, so it is somewhat of use. Also, I see in the most used package a minor flaw in logic in the binder, but it doesn’t break any functionality, so not a big deal. Finally, the process gave me a chance to do a deep-dive into Expressions, and that was very enlightening, so the entire process was still of use, even if the nuget package isn’t. 🙂

Automated Nuget package creation

We have some core libraries that a lot of other libraries depend on. While these change very infrequently, they were written a while ago and some refactoring is in order. The problem is I don’t want to have to doa lot of manual updating. I thought I’d look into automating Nuget packages.

The article has sample scripts which I’ll be able to adapt and setup to generate Nuget packages on build. I can then copy the packages to a local Nuget server ad then I’ll be able to set up the other libraries to use Nuget so they can easily get any future updates!

Cool new MS toys

I recently found out from a friend about MS Research’s Pex. There is some pretty cool stuff you can do with Pex, and the addition of Moles looks like it could be a pretty awesome testing suite. I have only scratched the surface of these tools.

Another cool new toy is NuGet. NuGet offers Gems-like package management for .Net. Cooler still is it is integrated into Visual Studio. You get a Powershell experience within VS to manage your packages. There is a brief intro video from Phil Haack, but I preferred David Ebbo’s extended tutorial.