> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to create a resource provider

> How to create a resource provider

All [resource providers][1] must be compiled in .Net assemblies. SuperOffice provider a base class in the *SuperOffice.Plugins.dll* called `ResourceDllProviderBase`, which makes it easy to get started.

Implementations must decorate the class with the `ResourceProvider` attribute, which NetServer will use to discover and load at runtime. The first parameter must be a name that uniquely identifies your provider. The second parameter is a priority number that can force your provider to be called before others, and thus override already-existing stuff. This is not normally a recommended practice, however, the lowest priority value is used first. SuperOffice default priority values are `int.MaxValue` divided by 2. If another provider that includes the same resource names with a lower priority value, such as `int.MaxValue / 3`, it takes precedence and overrides default resources supplied by SuperOffice.

The constructor expects two parameters:

* the name of the executing assembly
* the name of the resx resource files that contains the language-specific text resources.

## Code example

```csharp theme={null}
[ResourceProvider( "PartnerXResourceProvider", int.MaxValue )]
public class ResourceProvider : ResourceDllProviderBase
{
  public ResourceProvider()
    : base( System.Reflection.Assembly.GetExecutingAssembly(), ".Resources" )
  {
  }
}
```

## Dependencies

Assemblies must be declared in the application's configuration file. The key here is not special or mapped to anything else. It only needs to unique from other assemblies declared in the DynamicLoad section. The value must be the name of the resource assembly.

The value is optionally a full path, or when placed in the applications directory only needs to be the name of the assembly.

```XML theme={null}
<SuperOffice>
  ...
  <Factory>
    <DynamicLoad>
    ...
      <add key="UniqueName" value="UniqueName.Resources.dll" />
    </DynamicLoad>
  </Factory>
  ...
</SuperOffice>
```

## Example .NET project

In the example below, the project uses the NuGet package `SuperOffice.NetServer.Core` to easily get a reference to the *SuperOffice.Plugins.dll*.

![Example .Net project][img1]

## Resource Codes

| Abbreviation        | Country                  |
| ------------------- | ------------------------ |
| cs                  | Czech (Czech Republic)   |
| da                  | Danish                   |
| de                  | German                   |
| en-us               | English - United States  |
| es                  | Spanish                  |
| fi                  | Finnish                  |
| fr                  | French                   |
| it                  | Italian                  |
| ja                  | Japanese                 |
| nl                  | Dutch                    |
| no                  | Norwegian                |
| pl                  | Polish                   |
| default (see image) | English - United Kingdom |
| ru                  | Russian                  |
| sv                  | Swedish                  |
| zh-cn               | Chinese (S)              |

## Do it yourself

If you have special requirements, implement the `IResourceProvider` interface, or override the base class implementation. The methods `CanInitialize()`, `Initialize()`, `GetSupportedLanguages()`, and `GetResource(string symbol)` are easy to understand and implement.

The idea behind `CanInitialize` is that some providers may need database access, and so they should not be initialized too early. By doing a quick check and returning true only when everything is ready, you can postpone the initialization to the correct moment.

[1]: ./resource-providers

[img1]: /media/loc/en/api/localization/netserver-resource-provider.png


## Related topics

- [Resources](/en/automation/crmscript/howto/diary/book-resource.md)
- [How to perform an archive provider query](/en/api/archive-providers/how-to-query.md)
- [resource](/en/api/mdo-providers/reference/resource.md)
- [Resource providers](/en/api/localization/language/resource-providers.md)
- [How to create an invitation (services)](/en/api/web-services/howto/diary/create-invitation-services.md)
- [Create our own resx file](/en/api/localization/language/create-resx-file.md)
