Ok, I've been talking about Subsonic for a little bit. I'm working on a project now where I'm really starting to put it through its paces. I have to say that the more I work with it, the more impressed I am.
I must admit that I got sucked in by the scaffolding approach. You drop one control on a form and poof you have a data entry application. Well..almost. I was writing a form to do some simple content management. I didn't want the content to appear on the front list. With the scaffold control, it appears that you get everything. There is also a quicktable control which provides more control, but as soon as you need to add any logic to the process (hey I need to hash the password instead of storing it in clear text) at that point you are writing your own form.
On the plus side, writing your own form is much easier with Subsonic than without it. Subsonic plus partial classes in c# very easily solve the dilemma of customizing code that is generated. Typically, I need a method that retrieves an object by something other than the primary key. I typically let subsonic generate code for me into a separate data layer project. The subsonic code goes into a folder called 'generated'. I then create a second folder called 'Custom' at the same level. Any time I need to add a method to a subsonic class, I create a partial class in custom that has the same namespace and class name as the subsonic code, and add the method that I need. My new method appears on the objects as if subsonic created it. If I need to regenerate the subsonic code, my custom code remains in tact. Pretty cool stuff.
Thursday, December 13, 2007
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment