AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

; The Cognito Sync Manager allows your application to store data in the cloud for your users and synchronize across other devices. The library uses the sqlite for local storage API and defaults to inmemory where sqlite is not available to create a local cache for the data, similar to our SDK. This allows your application to access stored data even when there is no connectivity.

CognitoAWSCredentials credentials = new CognitoAWSCredentials("identityPoolId","RegionEndpoint")
//using default region from your app.config or awsconfig.xml
CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials);
// creating a dataset
Dataset playerInfo = cognitoSyncManager.OpenOrCreateDataset("playerInfo");
// add some values into your dataset
playerInfo.Put("high_score", "90");
playerInfo.Put("name", "John");
// push changes to remote if needed
playerInfo.Synchronize();
            
Note: Some platforms may only expose async methods such as SynchronizeAsync().

Inheritance Hierarchy

System.Object
  Amazon.CognitoSync.SyncManager.CognitoSyncManager

Namespace: Amazon.CognitoSync.SyncManager
Assembly: AWSSDK.CognitoSync.dll
Version: 3.x.y.z

Syntax

C#
public class CognitoSyncManager
         IDisposable

The CognitoSyncManager type exposes the following members

Constructors

NameDescription
Public Method CognitoSyncManager(CognitoAWSCredentials)

Creates an instance of CognitoSyncManager using Cognito Credentials, the region is picked up from the config if it available

CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials)
            

Public Method CognitoSyncManager(CognitoAWSCredentials, RegionEndpoint)

Creates an instance of CognitoSyncManager using cognito credentials and a specific region

CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials, RegionEndpoint.USEAST1)
            

Public Method CognitoSyncManager(CognitoAWSCredentials, AmazonCognitoSyncConfig)

Creates an instance of CognitoSyncManager using cognito credentials and a configuration object

CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials,new AmazonCognitoSyncConfig { RegionEndpoint =  RegionEndpoint.USEAST1})
            

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method Dispose()

Releases the resources consumed by this object

Public Method ListDatasets()

Retrieves a list of datasets from local storage. It may not reflect the latest dataset on the remote storage until the RefreshDatasetMetadata operation is performed.

Public Method OpenOrCreateDataset(string)

Opens or creates a dataset. If the dataset doesn't exist, an empty one with the given name will be created. Otherwise, the dataset is loaded from local storage. If a dataset is marked as deleted but hasn't been deleted on remote via the RefreshDatasetMetadata operation, it will throw System.InvalidOperationException.

Dataset dataset = cognitoSyncManager.OpenOrCreateDataset("myDatasetName");
            

Public Method RefreshDatasetMetadataAsync(CancellationToken)

Refreshes dataset metadata. Dataset metadata is pulled from remote storage and stored in local storage. Their record data isn't pulled down until you sync each dataset.

Public Method WipeData(bool)

Wipes all user data cached locally, including dataset metadata, and all records, and optionally identity id and session credentials. Any data that hasn't been synced will be lost. This method is usually used when customer logs out. Wipe Credentials and IdentityId.

Public Method WipeData()

Wipes all user data cached locally, including identity id, session credentials, dataset metadata, and all records. Any data that hasn't been synced will be lost. This method is usually used when customer logs out.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

Unity:
Supported Versions: 4.6 and above
Supported Platforms: Android, iOS, Standalone