# Class PersistenceParametersBatch OptimaJet.Workflow.Core.Model.PersistenceParametersBatch Represents a batch of serialized persistence operations for modified parameters of a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). Namespace: [OptimaJet.Workflow.Core.Model](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/) ```csharp public sealed class PersistenceParametersBatch ``` ## Properties `public IReadOnlyList Parameters { get; }` Gets the [SerializedParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/SerializedParameter/) instances that describe the persistence operations in this batch. `public Guid ProcessId { get; }` Gets the identifier of the [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) associated with this batch. `public string? TenantId { get; }` Gets the tenant identifier of the [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) associated with this batch, if any. `public bool IsEmpty { get; }` Gets a value indicating whether [PersistenceParametersBatch.Parameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/PersistenceParametersBatch/) contains no persistence operations. ## Methods `public void CommitFlags()` Updates the source parameters represented by [PersistenceParametersBatch.Parameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/PersistenceParametersBatch/) to reflect successful persistence. ### Remarks Each source [ParameterDefinitionWithValue](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionWithValue/) is marked as unmodified. A [SerializedParameter.PersistenceOperation.Delete](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/SerializedParameter.PersistenceOperation/) operation marks the source parameter as absent from persistence; [SerializedParameter.PersistenceOperation.Insert](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/SerializedParameter.PersistenceOperation/) and [SerializedParameter.PersistenceOperation.Update](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/SerializedParameter.PersistenceOperation/) operations mark it as present. Call this method only after the persistence operation completes successfully. `public static PersistenceParametersBatch CreateFromProcessInstance(ProcessInstance processInstance)` Creates a batch by selecting and serializing modified parameters from `processInstance` whose [ParameterDefinitionWithValue.Purpose](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionWithValue/) is [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) from which to select parameters. | ### Returns | Type | Description | | --- | --- | | `PersistenceParametersBatch` | A batch containing the selected [SerializedParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/SerializedParameter/) instances, or a batch for which [PersistenceParametersBatch.IsEmpty](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/PersistenceParametersBatch/) is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when no matching parameters are found. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `processInstance` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | `public static PersistenceParametersBatch CreateForSingleParameter(ProcessInstance processInstance, string parameterName)` Creates a batch for the modified parameter named `parameterName` in `processInstance` when its [ParameterDefinitionWithValue.Purpose](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionWithValue/) is [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) containing the parameter. | | `parameterName` | `String` | The name of the process parameter to select. | ### Returns | Type | Description | | --- | --- | | `PersistenceParametersBatch` | A batch containing a single [SerializedParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/SerializedParameter/) instance, or a batch for which [PersistenceParametersBatch.IsEmpty](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/PersistenceParametersBatch/) is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when no parameter with the specified name exists, its [ParameterDefinitionWithValue.Purpose](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionWithValue/) is not [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/), or it has not been modified. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `processInstance` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | | `ArgumentException` | `parameterName` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or empty. | ## Remarks Instances are created from a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) by selecting modified parameters whose [ParameterDefinitionWithValue.Purpose](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionWithValue/) is [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/). [Previous ParameterTypeExtensions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterTypeExtensions/) [Next ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/)