Back here I posted about the ActiveRecord pattern. Since then people have written to me asking how you actually implement it with regard to the business object not having to know anything about the database, but the ActiveRecord having to deal with any number of business objects that may subclass it. Well there's a number of ways to do it I suppose, but the one I use is to do it by way of a mixture of convention and reflection. So, by way of example, if you subclass ActiveRecord to create a Customer business object then, by convention, the stored procedure that creates it is called CreateCustomer. What I do then is to reflect on the database to find out what parameters that stored procedure takes, then I reflect on the object to get the property values. Again, by convention, the object has properties matching the stored procedure parameters. I have posted an implimentation of the create function below, to illustrate what I mean, along with the stored procedure I use to reflect on the database. In the next post on this topic, I'll look at the special case of serializing a master / detail relationship to the database.