Class BundleResourceManagerFactory
This implementation of IResourceManagerFactory uses a convention
to retrieve resources. In Java NLS, the convention is to use the same name for the
resource key propeties and for the resource file names. This presents a problem
for .NET because the resource generator already creates an internal class with the
same name as the .resx
file.
To work around this, we use the convention of appending the suffix "Bundle" to
the end of the type the resource key propeties are stored in. For example,
if our constants are stored in a class named ErrorMessages, the type
that will be looked up by this factory will be ErrorMessagesBundle (which is the
name of the .resx
file that should be added to your project).
This implementation can be inherited to use a different convention or can be replaced to get the resources from an external source.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Util
Assembly: Lucene.Net.dll
Syntax
public class BundleResourceManagerFactory : IResourceManagerFactory
Properties
| Improve this Doc View SourceResourceSuffix
The suffix to append to the resource key class name to locate the embedded resource.
Declaration
protected virtual string ResourceSuffix { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceCreate(Type)
Creates a System.Resources.ResourceManager instance using the specified resourceSource
.
Declaration
public virtual ResourceManager Create(Type resourceSource)
Parameters
Type | Name | Description |
---|---|---|
System.Type | resourceSource | The type representing the resource to retrieve. |
Returns
Type | Description |
---|---|
System.Resources.ResourceManager | A new System.Resources.ResourceManager instance. |
GetResourceName(Type)
Gets the fully-qualified name of the bundle as it would appear
using System.Reflection.Assembly.GetManifestResourceNames, without the
.resources
extension. This is the name that is passed to the
baseName
parameter of
System.Resources.ResourceManager.#ctor(System.String,System.Reflection.Assembly).
Declaration
protected virtual string GetResourceName(Type clazz)
Parameters
Type | Name | Description |
---|---|---|
System.Type | clazz | The type of the NLS-derived class where the field strings are located that identify resources. |
Returns
Type | Description |
---|---|
System.String | The resource name. |
Release(ResourceManager)
Releases the System.Resources.ResourceManager instance including any disposable dependencies.
Declaration
public virtual void Release(ResourceManager manager)
Parameters
Type | Name | Description |
---|---|---|
System.Resources.ResourceManager | manager | The System.Resources.ResourceManager to release. |