P
Pete Kane
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 ?
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 ?