> For the complete documentation index, see [llms.txt](https://tariksavas.gitbook.io/tarsave/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tariksavas.gitbook.io/tarsave/docs/how-to-use/datapersistencebuilder/setdatapersistenceconfig.md).

# SetDataPersistenceConfig

```csharp
DataPersistenceBuilder SetDataPersistenceConfig(DataPersistenceConfig config)
```

**Purpose:** Sets the configuration data for the data persistence system, allowing the builder to configure how data should be handled (including encryption, compression, etc.) based on the provided configuration.

**Parameters:**

* `dataPersistenceConfig`: An instance of the `DataPersistenceConfig` class that contains all the settings and preferences for configuring the data persistence system, such as encryption and compression options.

**Return Value:** Returns the `DataPersistenceBuilder` instance to allow method chaining.

```csharp
public void ConfigureDataPersistence()
{
    AESCryptographyConfig aesConfig = 
        ScriptableObject.CreateInstance<AESCryptographyConfig>();
        
    DataPersistenceConfig config = 
        ScriptableObject.CreateInstance<DataPersistenceConfig>();
    
    config.encryption = true;
    config.compression = true;
    config.aesCryptographyConfig = aesConfig;

    DataPersistenceBuilder builder = new DataPersistenceBuilder();
    builder.SetDataPersistenceConfig(config);
}
```

This method sets up the configuration that guides the builder in creating and setting up the `DataPersistenceService`. The configuration specifies important features such as whether encryption and compression should be enabled, as well as the details required for those features (like AES configuration for encryption).
