Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom Attributes
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Custom Attributes
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01400582
Message ID:
01400582
Views:
111
Hello All, I have a method in my App class called GetText, this function accepts a string as input param, and returns a corresponding string value from a lookup table, the table has two fields, KeyName and KeyValue, my concern is , as and when I add more methods and classes that will utilise this function I have to remember to add records to the the underlying lookup table on the "live" server

e.g.
string MethodOneInSomeClass()
{
    return App.GetText("GetSiteName")
}
in this case I have to add
KeyName             KeyValue
"GetSiteName"     "London"
to the lookup table, I got bitten by this recently ( i.e. forgot to add the record ) and am trying to think of a way to avoid doing so in the future - one way I've thought might be ok, is, decorate all the methods that use the function with a custom attribute, e.g.
[GetTextAttribute("GetSiteName")]
string MethodOneInSomeClass()
{
    return App.GetText("GetSiteName")
}
and in the app use Reflection to list all attributes of type "GetTextAttribute" that are not present in the lookup table. Does this seem a reasonable approach ?
Regards,
Peter J. Kane



Pete
Next
Reply
Map
View

Click here to load this message in the networking platform