tarsave
  • Documentation
    • Introduction
    • Installation
    • How to Use
      • DataPersistenceConfig
      • Encryption
      • Compression
      • DataPersistenceBuilder
        • SetDataPersistenceConfig
        • Build
      • DataPersistenceService
        • Save
        • SaveAsync
        • AutoSaveAsync
        • Load
        • LoadAsync
        • Delete
        • DeleteAll
      • Transform Data
      • Audio Data
  • Log
    • Change Log
      • v1.0.6
      • v1.0.5
      • v1.0.4
      • v1.0.3
      • v1.0.2
Powered by GitBook
On this page
  1. Documentation
  2. How to Use
  3. DataPersistenceBuilder

Build

DataPersistenceService Build()

Purpose: This method is used to construct and return a fully configured DataPersistenceService. This service handles the saving, loading, and deletion of data based on the configuration provided.

Parameters: None

Return Value: Returns a fully configured DataPersistenceService instance if the configuration is valid, otherwise returns null.

Key Behavior:

  • Validates the provided configuration.

  • Dynamically creates and configures components for encryption, compression, streaming, and serialization based on the configuration.

  • Returns the DataPersistenceService that combines these components to handle data operations.

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

    DataPersistenceService service = new DataPersistenceBuilder()
        .SetDataPersistenceConfig(config)
        .Build();
}
PreviousSetDataPersistenceConfigNextDataPersistenceService

Last updated 6 months ago