asp.net - RegisterProperty cache display name -
i'm using registerproperty csla. have displayattribute , displaynameattribute on properties attached resource. notice .name property of each of registerproperty cached. if switch language, .name not refreshed. causes trouble since i'm using stringlengthattribute , others handle business rules.
is there way refresh .name or make sure value isn't cached?
for decided create own attribute takes display name parameter. there way disable caching.
public class stringlengthexattribute inherits stringlengthattribute private _displayresourcename string = "" public sub new(byval maximumlength integer) mybase.new(maximumlength) me.errormessageresourcename = "ruleexceedmaxcharacter" me.errormessageresourcetype = gettype(my.resources) end sub public sub new(byval displayresourcename string, byval maximumlength integer) mybase.new(maximumlength) _displayresourcename = displayresourcename me.errormessageresourcename = "ruleexceedmaxcharacter" me.errormessageresourcetype = gettype(my.resources) end sub public overrides function formaterrormessage(name string) string if _displayresourcename <> "" name = my.resources.resourcemanager.getstring(_displayresourcename) end if return mybase.formaterrormessage(name) end function end class
Comments
Post a Comment