Internal

After writing

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.

Share

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled