Class DbResourceDataManager
System.Object
  Westwind.Globalization.DbResourceDataManager
public abstract class DbResourceDataManager : object, IDbResourceDataManager

Class Members

MemberDescription

AddResource

Adds a resource to the Localization Table

public virtual int AddResource(ResourceItem resource)

public virtual int AddResource(string resourceId,     object value,     string cultureName,     string resourceSet,     string comment,     bool valueIsFileName,     int valueType)

CreateBackupTable

Create a backup of the localization database.

Note the table used is the one specified in the Configuration.ResourceTableName

public virtual bool CreateBackupTable(string BackupTableName)

CreateDbResourceDataManager

Creates an instance of the DbResourceDataManager based on configuration settings

public static DbResourceDataManager CreateDbResourceDataManager(Type managerType,     DbResourceConfiguration configuration)

public static DbResourceDataManager CreateDbResourceDataManager(DbResourceProviderTypes type,     DbResourceConfiguration configuration)

CreateLocalizationTable

Creates the Localization table on the current connection string for the provider.

public virtual bool CreateLocalizationTable(string tableName)

DeleteResource

Deletes a specific resource ID based on ResourceId, ResourceSet and Culture. If an empty culture is passed the entire group is removed (ie. all locales).

public virtual bool DeleteResource(string resourceId,     string resourceSet,     string cultureName)

DeleteResourceSet

Deletes an entire resource set from the database. Careful with this function!

public virtual bool DeleteResourceSet(string ResourceSet,     string cultureName)

GenerateResources

Persists resources to the database - first wipes out all resources, then writes them back in from the ResourceSet

public virtual bool GenerateResources(IDictionary resourceList,     string cultureName,     string resourceSet,     bool deleteAllResourceFirst)

GetAllLocaleIds

Gets all the locales for a specific resource set.

Returns a table named TLocaleIds (LocaleId field)

public virtual List GetAllLocaleIds(string resourceSet)

GetAllLocalesForResourceSet

public virtual List GetAllLocalesForResourceSet(string resourceSet)

GetAllResourceIdListItems

Returns a list with ResourceId and HasValues fields where the ResourceId is formatted for HTML display.

public virtual List GetAllResourceIdListItems(string resourceSet)

GetAllResourceIds

Returns all available resource ids for a given resource set in all languages.

Returns a ResourceIdItem object with ResourecId and HasValue fields. HasValue returns whether there are any entries in any culture for this resourceId

public virtual List GetAllResourceIds(string resourceSet)

GetAllResources

Returns a list of all the resources for all locales. The result is in a table called TResources that contains all fields of the table. The table is ordered by LocaleId.

This version returns either local or global resources in a Web app

Fields: ResourceId,Value,LocaleId,ResourceSet,Type

public virtual List GetAllResources(bool localResources,     bool applyValueConverters,     string resourceSet)

GetAllResourceSets

Returns all available resource sets

public virtual List GetAllResourceSets(ResourceListingTypes type)

GetAllResourcesForCulture

Gets all the Resourecs and ResourceIds for a given resource set and Locale

returns a table "TResource" ResourceId, Value fields

public virtual List GetAllResourcesForCulture(string resourceSet,     string cultureName)

GetDb

Creates an instance of the DataAccess Data provider

public virtual DataAccessBase GetDb(string connectionString)

GetFileInfo

Internal routine that looks at a file and based on its extension determines how that file needs to be stored in the database. Returns FileInfoFormat structure

public static FileInfoFormat GetFileInfo(string fileName,     bool noPhysicalFile)

GetResourceItem

Returns a resource item that returns both the Value and Comment to the fields to the client.

public virtual ResourceItem GetResourceItem(string resourceId,     string resourceSet,     string cultureName)

GetResourceItems

Returns all resource items for a given resource ID in all locales. Returned as full ResourceItem objects

public virtual IEnumerable GetResourceItems(string resourceId,     string resourceSet,     bool forAllResourceSetLocales)

GetResourceObject

Returns an object from the Resources. Attempts to convert the object to its original type. Use this for any non-string types. Useful for binary resources like images, icons etc.

While this method can be used with strings, GetResourceString() is much more efficient.

public virtual object GetResourceObject(string resourceId,     string resourceSet,     string cultureName)

GetResourcesAsJavascriptObject

Creates an global JavaScript object object that holds all non-control local string resources as property values.

All resources are returned in normalized fashion from most specifc to more generic (de-ch,de,invariant depending on availability)

public virtual string GetResourcesAsJavascriptObject(string javaScriptVarName,     string resourceSet,     string localeId)

GetResourceSet

Returns a specific set of resources for a given culture and 'resource set' which in this case is just the virtual directory and culture.

public virtual IDictionary GetResourceSet(string cultureName,     string resourceSet)

GetResourceSetNormalizedForLocaleId

Returns a fully normalized list of resources that contains the most specific locale version for the culture provided.

This means that this routine walks the resource hierarchy and returns the most specific value in this order: de-ch, de, invariant.

public virtual Dictionary<String,Object> GetResourceSetNormalizedForLocaleId(string cultureName,     string resourceSet)

GetResourceString

Returns an individual Resource String from the database

public virtual string GetResourceString(string resourceId,     string resourceSet,     string cultureName)

GetResourceStrings

Returns all the resource strings for all cultures for a specific resource Id. Returned as a dictionary.

public virtual Dictionary<String,String> GetResourceStrings(string resourceId,     string resourceSet,     bool forAllResourceSetLocales)

IsLocalizationTable

Checks to see if the LocalizationTable exists

public virtual bool IsLocalizationTable(string tableName)

IsValidCulture

Returns true or false depending on whether the two letter country code exists

public virtual bool IsValidCulture(string IetfTag)

RenameResource

Renames a given resource in a resource set. Note all languages will be renamed

public virtual bool RenameResource(string ResourceId,     string NewResourceId,     string ResourceSet)

RenameResourceProperty

Renames all property keys for a given property prefix. So this routine updates lblName.Text, lblName.ToolTip to lblName2.Text, lblName2.ToolTip if the property is changed from lblName to lblName2.

public virtual bool RenameResourceProperty(string Property,     string NewProperty,     string ResourceSet)

RenameResourceSet

Renames a resource set. Useful if you need to move a local page resource set to a new page. ResourceSet naming for local resources is application relative page path:

test.aspx subdir/test.aspx

Global resources have a simple name

public virtual bool RenameResourceSet(string OldResourceSet,     string NewResourceSet)

ResourceExists

Checks to see if a resource exists in the resource store

public virtual bool ResourceExists(string ResourceId,     string CultureName,     string ResourceSet)

RestoreBackupTable

Restores the localization table from a backup table by first wiping out

public virtual bool RestoreBackupTable(string backupTableName)

SetError

public sealed void SetError()

public sealed void SetError(string message)

public sealed void SetError(Exception ex)

SetFileDataOnResourceItem

public static ResourceItem SetFileDataOnResourceItem(ResourceItem item,     Byte[] data,     string fileName)

UpdateOrAddResource

Updates a resource if it exists, if it doesn't one is created

public virtual int UpdateOrAddResource(ResourceItem resource)

public virtual int UpdateOrAddResource(string resourceId,     object value,     string cultureName,     string resourceSet,     string comment,     bool valueIsFileName,     int valueType)

UpdateResource

Updates an existing resource in the Localization table

public virtual int UpdateResource(string resourceId,     object value,     string cultureName,     string resourceSet,     string comment,     bool valueIsFileName,     int valueType)

public virtual int UpdateResource(ResourceItem resource)

Configuration

Instance of the DbResourceConfiguration that can be overridden Defaults to the default instance - DbResourceConfiguration.Current

ErrorMessage

Error message that can be checked after a method complets and returns a failure result.

Requirements

Namespace: Westwind.Globalization
Assembly: westwind.globalization.dll

© West Wind Technologies, 2006 - 2019 • Updated: 01/24/18
Comment or report problem with topic