Remote data storage using Cognito Sync service on which we can invoke actions like creating a dataset or record.
Inheritance: IDisposable
Ejemplo n.º 1
0
        public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config)
        {
            if (cognitoCredentials == null)
            {
                throw new ArgumentNullException("cognitoCredentials");
            }

            if (string.IsNullOrEmpty(cognitoCredentials.IdentityPoolId))
            {
                throw new ArgumentNullException("cognitoCredentials.IdentityPoolId");
            }
            this.cognitoCredentials = cognitoCredentials;
            Local = new SQLiteLocalStorage(System.IO.Path.Combine(Application.persistentDataPath, DATABASE_NAME));
            remote = new CognitoSyncStorage(cognitoCredentials, config);
            cognitoCredentials.IdentityChangedEvent += this.IdentityChanged;

            _logger = Logger.GetLogger(this.GetType());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new Dataset
 /// </summary>
 /// <param name="datasetName">The name of the dataset</param>
 /// <param name="cognitoCredentials">The Cognito Credentials associated with the dataset</param>
 /// <param name="local">Local storage, can be InMemoryStorage or SQLiteStorage or Some Custom Storage Class which implements <see cref="Amazon.CognitoSync.SyncManager.ILocalStorage"/></param>
 /// <param name="remote">Remote storage</param>
 internal Dataset(string datasetName, CognitoAWSCredentials cognitoCredentials, ILocalStorage local, CognitoSyncStorage remote)
 {
     this._datasetName = datasetName;
     this._cognitoCredentials = cognitoCredentials;
     this._local = local;
     this._remote = remote;
     _logger = Logger.GetLogger(this.GetType());
     DatasetSetupInternal();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates an instance of CognitoSyncManager using cognito credentials and a configuration object
        /// <code>
        /// CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials,new AmazonCognitoSyncConfig { RegionEndpoint =  RegionEndpoint.USEAST1})
        /// </code>
        /// </summary>
        /// <param name="cognitoCredentials"><see cref="Amazon.CognitoIdentity.CognitoAWSCredentials"/></param>
        /// <param name="config"><see cref="Amazon.CognitoSync.AmazonCognitoSyncConfig"/></param>
        public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config)
        {
            if (cognitoCredentials == null)
            {
                throw new ArgumentNullException("cognitoCredentials");
            }

#if BCL
            ValidateParameters();
#endif

            this.CognitoCredentials = cognitoCredentials;

            Local = new SQLiteLocalStorage();

            Remote = new CognitoSyncStorage(cognitoCredentials, config);

            cognitoCredentials.IdentityChangedEvent += this.IdentityChanged;

            _logger = Logger.GetLogger(this.GetType());
        }