Static 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.
Calls through to DbResInstance
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.DbRes
public class DbRes : object
Class Members
Member | Description | |
---|---|---|
Constructor |
||
ClearResources |
Clears resources from memory and forces reloading of all ResourceSets. Effectively unloads the ResourceManager and ResourceProvider. public static void ClearResources() |
|
DeleteResource |
Deletes a resource entry public static bool DeleteResource(string resourceId, string resourceSet, string lang) |
|
GetResourceManager |
Returns an instance of a DbResourceManager public static ResourceManager GetResourceManager(string resourceSet) |
|
GetResourceSet |
Returns a resource set for a given resource public static 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 static 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 static string TDefault(string resId, string defaultText, string resourceSet, string lang) |
|
TFormat |
Creates a localized format string that is transformed using the specified resource id. public static string TFormat(string format, string resId, string resourceSet, Object[] args) public static string TFormat(string format, string resId, string resourceSet, string lang, Object[] args) |
|
THtml |
public static 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 static object TObject(string resId, string resourceSet, string lang, bool autoAdd) |
|
WriteResource |
Writes a resource either creating or updating an existing resource public static bool WriteResource(string resourceId, string value, string lang, string resourceSet) |
Requirements
Namespace: Westwind.GlobalizationAssembly: westwind.globalization.dll
© West Wind Technologies, 2006 - 2019 • Updated: 01/24/18
Comment or report problem with topic