C# Class Westwind.Globalization.StronglyTypedResources

Class that handles generating strongly typed resources for global Web resource files. This feature is not supported in ASP.NET stock projects and doesn't support custom resource providers in WAP.
Afficher le fichier Open project: RickStrahl/Westwind.Globalization

Méthodes publiques

Méthode Description
CreateClassFromAllDatabaseResources ( string Namespace, string FileName, IEnumerable resourceSets = null ) : string

Creates strongly typed classes from all global resources in the current application from the active DbResourceManager. One class is created which contains each of the resource classes. Classnames are not necessarily named with Uses the default DbResourceConfiguration.Current settings for connecting to the database.

CreateClassFromDatabaseResource ( string ResourceSetName, string Namespace, string Classname, string FileName ) : string

Creates a strongly typed resource class for a ResoureSet from the DbResourceManager. Note: Uses the default ResourceProvider settings as set in the DbResourceConfiguration.Current property for opening the database and otherwise setting values.

CreateClassFromFromAllGlobalResXResources ( string Namespace, string FileName ) : string

Creates a class containing strongly typed resources of all resource keys in all global resource ResX files. A single class file with multiple classes is created. The extension of the output file determines whether VB or CS is generated

CreateClassFromResXResource ( string ResXFile, string Namespace, string Classname, string FileName ) : string

Creates an ASP.NET compatible strongly typed resource from a ResX file in ASP.NET. The class generated works only for Global Resources by calling GetGlobalResourceObject. This routine parses the raw ResX files since you can't easily get access to the active ResourceManager in an ASP.NET application since the assembly is dynamically named and not easily accessible.

CreateClassFromResourceSet ( ResourceSet resourceSet, string nameSpace, string classname, string fileName ) : string
CreateGlobalResxResourceDesignerFiles ( string Namespace, CodeGenerationLanguage lang ) : void

Creates a strongly typed resource class that uses the ASP.NET Resource Manager rather than using Resx .NET resources which basically results in duplicated resource sets loaded. Overwrites the generated.

CreateResxDesignerClassFromResourceSet ( string resourceSetName, string nameSpace, string classname, string fileName ) : string

Creates a strongly typed resource from a ResourceSet object. The ResourceSet passed should always be the invariant resourceset that contains all the ResourceIds. Creates strongly typed keys for each of the keys/values.

CreateResxDesignerClassFromResxFile ( string resxFile, string resourceSetName, string namespaceName, bool vb = false ) : void

Creates a StronglyTyped class from a REsx file. Can be used after a Resx fi

CreateResxDesignerClassesFromAllDatabaseResources ( string ns, string outputPath, IEnumerable resourceSets = null ) : string

Creates strongly typed classes from all global resources in the current application from the active DbResourceManager. One class is created which contains each of the resource classes. Classnames are not necessarily named with Uses the default DbResourceConfiguration.Current settings for connecting to the database.

SafeVarName ( string phrase ) : string
StronglyTypedResources ( string WebPhysicalPath ) : System

Private Methods

Méthode Description
CreateClassHeader ( string Classname, string nameSpace, bool IsVb, StringBuilder sbClass ) : void

Creates the class header for a page

CreateNameSpaceWrapper ( string Namespace, bool IsVb, string Class ) : string

Wraps the body of a class (or multiple classes) into a namespace and adds teh appropriate using/imports statements. If no namespace is passed the using/imports are still added, but no namespace is assigned

CreateResxDesignerClassHeader ( string Classname, string nameSpace, bool IsVb, StringBuilder sbClass ) : void

Creates the class header for a page

CreateResxDesignerNameSpaceWrapper ( string Namespace, bool IsVb, string Class ) : string

Wraps the body of a class (or multiple classes) into a namespace and adds teh appropriate using/imports statements. If no namespace is passed the using/imports are still added, but no namespace is assigned

IsFileVb ( string FileName ) : bool

Checks to see if the file extension is .vb and if so returns true

Method Details

CreateClassFromAllDatabaseResources() public méthode

Creates strongly typed classes from all global resources in the current application from the active DbResourceManager. One class is created which contains each of the resource classes. Classnames are not necessarily named with Uses the default DbResourceConfiguration.Current settings for connecting to the database.
public CreateClassFromAllDatabaseResources ( string Namespace, string FileName, IEnumerable resourceSets = null ) : string
Namespace string Optional namespace for the generated file
FileName string Output class file. .cs or .vb determines code language
resourceSets IEnumerable
Résultat string

CreateClassFromDatabaseResource() public méthode

Creates a strongly typed resource class for a ResoureSet from the DbResourceManager. Note: Uses the default ResourceProvider settings as set in the DbResourceConfiguration.Current property for opening the database and otherwise setting values.
public CreateClassFromDatabaseResource ( string ResourceSetName, string Namespace, string Classname, string FileName ) : string
ResourceSetName string The name of the resource set. Should be a GLOBAL resource
Namespace string The namespace for the generated class. Null or string.Empty to not generate a namespace
Classname string Name of the class to be generated
FileName string Output filename for the CSharp class. If null no file is generated and only the class is returned
Résultat string

CreateClassFromFromAllGlobalResXResources() public méthode

Creates a class containing strongly typed resources of all resource keys in all global resource ResX files. A single class file with multiple classes is created. The extension of the output file determines whether VB or CS is generated
public CreateClassFromFromAllGlobalResXResources ( string Namespace, string FileName ) : string
Namespace string
FileName string Output file name for the generated class. .cs and .vb generate appropriate languages
Résultat string

CreateClassFromResXResource() public méthode

Creates an ASP.NET compatible strongly typed resource from a ResX file in ASP.NET. The class generated works only for Global Resources by calling GetGlobalResourceObject. This routine parses the raw ResX files since you can't easily get access to the active ResourceManager in an ASP.NET application since the assembly is dynamically named and not easily accessible.
public CreateClassFromResXResource ( string ResXFile, string Namespace, string Classname, string FileName ) : string
ResXFile string
Namespace string
Classname string
FileName string Output filename for the CSharp class. If null no file is generated and only the class is returned
Résultat string

CreateClassFromResourceSet() public méthode

public CreateClassFromResourceSet ( ResourceSet resourceSet, string nameSpace, string classname, string fileName ) : string
resourceSet System.Resources.ResourceSet
nameSpace string
classname string
fileName string
Résultat string

CreateGlobalResxResourceDesignerFiles() public méthode

Creates a strongly typed resource class that uses the ASP.NET Resource Manager rather than using Resx .NET resources which basically results in duplicated resource sets loaded. Overwrites the generated.
public CreateGlobalResxResourceDesignerFiles ( string Namespace, CodeGenerationLanguage lang ) : void
Namespace string
lang CodeGenerationLanguage
Résultat void

CreateResxDesignerClassFromResourceSet() public méthode

Creates a strongly typed resource from a ResourceSet object. The ResourceSet passed should always be the invariant resourceset that contains all the ResourceIds. Creates strongly typed keys for each of the keys/values.
public CreateResxDesignerClassFromResourceSet ( string resourceSetName, string nameSpace, string classname, string fileName ) : string
resourceSetName string
nameSpace string
classname string Name of the class to generate. Pass null to use the ResourceSet name
fileName string Output filename for the CSharp class. If null no file is generated and only the class is returned
Résultat string

CreateResxDesignerClassFromResxFile() public méthode

Creates a StronglyTyped class from a REsx file. Can be used after a Resx fi
public CreateResxDesignerClassFromResxFile ( string resxFile, string resourceSetName, string namespaceName, bool vb = false ) : void
resxFile string
resourceSetName string
namespaceName string
vb bool
Résultat void

CreateResxDesignerClassesFromAllDatabaseResources() public méthode

Creates strongly typed classes from all global resources in the current application from the active DbResourceManager. One class is created which contains each of the resource classes. Classnames are not necessarily named with Uses the default DbResourceConfiguration.Current settings for connecting to the database.
public CreateResxDesignerClassesFromAllDatabaseResources ( string ns, string outputPath, IEnumerable resourceSets = null ) : string
ns string Optional namespace for the generated file
outputPath string
resourceSets IEnumerable
Résultat string

SafeVarName() public static méthode

public static SafeVarName ( string phrase ) : string
phrase string
Résultat string

StronglyTypedResources() public méthode

public StronglyTypedResources ( string WebPhysicalPath ) : System
WebPhysicalPath string
Résultat System