views:

56

answers:

1

I've got a program I'm creating that reports on another certain programs backup xml files. I've gotten to the point where I need to implement some type of ITaggable interface - but am unsure how to go about it code wise.

My idea is that each item (BackupClient, BackupVersion, and BackupFile) should implement an ITaggable interface for highlighting old, out of date, or non-existent files in their HTML or Excel report. The user will be able to specify tags in the settings.

My question is this, how can a user dynamically specify a "tag" such as File Date > 3 days old? - Background Color = Red. Actually I guess my question is more, how can I, the programmer, implement this dynamically? I was thinking Expression trees, but am unsure this is the way to go as I havn't studied them much.

I know my ITaggable interface would have methods such as AddTag(T tag), RemoveTag(T tag), but what exactly specifies the criteria for the tag to be added?

I realize this may be subjective, and can be marked as wiki if need be, but I truly am stuck. Any input would be greatly helpful!

A: 

Well after discussing with a fellow programmer, the best solution may be the Vistor Pattern. It won't clutter my classes, and it will keep everything clean.

Visitor Pattern

Jack