Helper class that handles access to the DbResourceManager more easily with single method access. The T() method provides an easy way to embed resources into applications using the resource key.
Also allows for resource reading, writing (new and updates transparently), deleting and clearing of resources from memory.
This class uses the DbResourceManager class to access resources and still uses the standard ResourceManager infrastructure of .NET to cache resources efficiently in memory. Data access occurs only on intial access of each resource set/locale.
Westwind.Globalization.DbResInstance
public class DbResInstance : object
Class Members
Member | Description | |
---|---|---|
Constructor |
||
ClearResources |
Clears resources from memory and forces reloading of all ResourceSets. Effectively unloads the ResourceManager and ResourceProvider. public void ClearResources() |
|
DeleteResource |
Deletes a resource entry public bool DeleteResource(string resourceId, string resourceSet, string lang) |
|
GetResourceManager |
Returns an instance of a DbResourceManager public ResourceManager GetResourceManager(string resourceSet) |
|
GetResourceSet |
Returns a resource set for a given resource public ResourceSet GetResourceSet(string resourceSet, string lang) |
|
T |
Localization helper function that Translates a resource Id to a resource value string. Easy access that allows full control over the resource to retrieve or default UiCulture locale retrieval. public string T(string resId, string resourceSet, string lang) |
|
TDefault |
Localization helper function that Translates a resource Id to a resource value string. If id is not found default text is returned. Easy access that allows full control over the resource to retrieve or default UiCulture locale retrieval. public string TDefault(string resId, string defaultText, string resourceSet, string lang) |
|
TFormat |
Creates a localized format string that is transformed using the specified resource id. The translated text is the first parameter in the format string public string TFormat(string format, string resId, string resourceSet, Object[] args) |
|
THtml |
public HtmlString THtml(string resId, string resourceSet, string lang) |
|
TObject |
Localization helper function that Translates a resource Id to a resource value object. Use this function if you're retrieving non-string values - for string values just use T. public object TObject(string resId, string resourceSet, string lang, bool autoAdd) |
|
WriteResource |
Writes a resource either creating or updating an existing resource public bool WriteResource(string resourceId, string value, string lang, string resourceSet) |
|
AutoAddResources |
Determines whether resources that fail in a lookup are automatically added to the resource table |
|
Configuration |
Requirements
Namespace: Westwind.GlobalizationAssembly: westwind.globalization.dll
© West Wind Technologies, 2006 - 2019 • Updated: 01/24/18
Comment or report problem with topic