# Class TenantGlobalParameterApi OptimaJet.Workflow.Core.Persistence.TenantGlobalParameterApi Provides global parameter operations through an [IPersistenceProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IPersistenceProvider/) for a tenant-specific or shared scope. Namespace: [OptimaJet.Workflow.Core.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/) ```csharp public sealed class TenantGlobalParameterApi ``` ## Constructors `public TenantGlobalParameterApi(IPersistenceProvider persistenceProvider, string? tenantId)` Initializes a [TenantGlobalParameterApi](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterApi/) that uses the specified [IPersistenceProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IPersistenceProvider/) and tenant scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `persistenceProvider` | `IPersistenceProvider` | The [IPersistenceProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IPersistenceProvider/) used for global parameters. | | `tenantId` | `String` | The tenant identifier. If [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), empty, or composed only of white-space characters, the shared global parameter scope is used. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `persistenceProvider` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | ## Properties `public string? TenantId { get; }` Gets the tenant identifier that defines the global parameter scope. ## Methods `public Task SaveAsync(string type, string name, T value)` Saves a global parameter value in the tenant-specific or shared scope represented by this instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `name` | `String` | The parameter name. | | `value` | `{T}` | The parameter value. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `type` or `name` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | `public Task LoadAsync(string type, string name)` Loads a global parameter value from the tenant-specific or shared scope represented by this instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `name` | `String` | The parameter name. | ### Returns | Type | Description | | --- | --- | | `Task` | The parameter value, or the [default](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/default) value of `T` when no matching parameter exists. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `type` or `name` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | `public Task> LoadWithNamesAsync(string type, Sorting? sort = null)` Loads the names and values of global parameters that have a logical type in the tenant-specific or shared scope represented by this instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `sort` | `Sorting` | The optional [Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task` | A mapping from parameter names to values. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `type` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | `public Task> LoadValuesAsync(string type, Sorting? sort = null)` Loads the values of global parameters that have a logical type in the tenant-specific or shared scope represented by this instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `sort` | `Sorting` | The optional [Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | The parameter values. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `type` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | `public Task> LoadWithPagingAsync(string type, Paging paging, Sorting? sort = null)` Loads a page of global parameter values that have a logical type from the tenant-specific or shared scope represented by this instance, together with the total matching count. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `paging` | `Paging` | The [Paging](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Paging/) settings. | | `sort` | `Sorting` | The optional [Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | A [PagedResponse](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/PagedResponse-T/) containing the selected parameter values and total matching count. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `type` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | `public Task DeleteAsync(string type, string? name = null)` Deletes global parameters of a logical type from the tenant-specific or shared scope represented by this instance, optionally limiting the deletion by parameter name. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `name` | `String` | The parameter name to delete, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to delete every parameter of the logical type. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `type` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | [Previous Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) [Next TenantGlobalParameterKey](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/)