Monday, October 29, 2007 12:01 PM
I think SubSonic is simply amazing. It has saved me so much time and effort of writing. One little trick that it's got is the LoadFromPost method the Models inherit from the SubSonic.AbstractRecord<T> class.
What LoadFromPost does is iterate over the the Request.Forms collection and matches the name of the form element with the corresponding property for your Model. So what that means is no more of this.
1: Product prod = new Product();
2: prod.Name = name.Text;
3: ....//More code setting the properties based on the form
So all you now have to do is this
1: Product prod = new Product
2: prod.LoadFromPost();//this loads up all the properties.
Filed under: asp.net, SubSonic