PropertyInfo[] obj_properities = this.GetType().GetProperties();
foreach (PropertyInfo prop in obj_properities)
{
//Is this the Properity we are looking for?
if (prop.Name == properity)
{
//Get the Attributes on the Properity
object[] prop_attributes = prop.GetCustomAttributes(true);
foreach (object attribute in prop_attributes)
{
//Is this the Column Name?
if (attribute is DBColumn)
{
//Do Something
break;
}
}
}
}
For the millionth time (or more like 3rd or 4th) I thought it would be nice if the object could provide this information for me. The problem was that I need my Selector object to be able to access this information as well (and I don't want the Selector Object to inherit from DBObject). So I Created another object with some of the information I use more often called Internal (I don't like the name but couldn't think of what else to call it.)
The Problem with this was that I didn't want everyone to be able to call these internal methods. So I created an InternalAttribute, and the Internal object checks that the caller has the InternalAttribue before it'll return any information. This isn't a perfect solution (I'd rather the methods never show up at all) but it seems to work so far.
No comments:
Post a Comment