So, I'm trying to make a good superclass for data access objects that can generate a tsql query to find all the properties of the public string of the subclass. I want to use reflection to get the type of the subclass, and then iterate over all the properties of the public row of the object, as these property names match the database column names. Then I can use these property names to generate a tsql query.
[caveat: hey, id is more likely to use nhibernate, but I just can't convince these guys to use this]
[I could also solve this with generics, but I think they find the pedigrees scary because they are guys from VB.net (sorry if I hurt you with VB.net peeps; ()]
So, the base object looks something like this:
public abstract class RepositoryBase { public static IList<RepositoryBase> Search() {
Is this possible or advisable?
While I was typing this, I was like "screw it, I'll just do it with generics."
Thanks for reading!
Mark Rogers Jan 19 '09 at 16:35 2009-01-19 16:35
source share