My code just went SubSonic.

I absolutely love the the goodness which is SubSonic 2.0.3 (2.0.4 on it's way). It's basically a way of automating most of your mundane day to day Database tasks (CRUD - Create, Read, Update, Delete) by using it in a form of native objects.

Example time:

         NxsFINExpense ExpenseClaim = new NxsFINExpense();
        ExpenseClaim.Amount = Convert.ToDecimal( dtbleResult.Rows[0][1] );
        ExpenseClaim.Description = dtbleResult.Rows[0][2].ToString();
        ExpenseClaim.ReceiptDate = Convert.ToDateTime(dtbleResult.Rows[0][0]);

Basically there is a table in my Database called "nxsFIN_Expenses" and each of the properties found on the ExpenseClaim Class is in fact a field within the table (respective type setting also associated via Convert casting).

The part that I love the most is "ExpenseClaim.Save()" which pretty much kills all efforts to writing the "INSERT INTO" bloated SQL Query. This is the kind of magic I've come to embrace inside the .NET community in that, basically everyone's just as lazy as me and would prefer to focus on hard-logic instead of basic CRUD's for example.

I have to say, in the my old Coldfusion circle's we really didn't have anything this automated. I think the closest I've seen probably is "Model-Glue: Unity"  Framework apparently when I last spoke to Sean about it, he stated it cained Ruby-on-Rails (Sean's wise and if he says it did, well I'll assume it did!).

Combine SubSonic with Visual Studio 2008, SQL Express and overall I have a nice warm fuzzy glowing feeling about my progress so far. Whom knows, with this ExpenseClaim .NET application I'm writing I may even get my expenses lodged in-time from here on out.

All thanks to SubSonic's productivity gains (did I oversell that?)

Points to note:

  • So far my entire development environment is costing $0 (i.e assuming I didn't work for Microsoft).
  • SubSonic has some minor issues, like you have to update the Builder.abp file every time you make a database change (to ensure that the framework reflects the database appropriately. I had Namespace errors when I didn't do this).
  • You need to pay attention to the "Getting Started" videos, as it can be a bit of a pain to setup.
  • I'm guessing with complex Database(s) things could get a bit un-nerving (feel free to shoot this point down as I'm not locked into that belief).
  • LINQ + SubSonic appear to play well with one another, so I'll explore this at a later date.
  • It has a really cool trick (this will get it the ladies). In that it will take a plural (Categories) and rename it to (Category) when dealing with singular references (ie ActiveRecord). Doesn't that make you feel gooey inside, reading this? damn straight.
  • I think SubSonic and I should kiss, you know.. to break the tension.. (Simpsons Movie fans will relate to that joke heh).

Next.. bolting on the Silverlight GUI.