Amazon.CognitoSync.SyncManager.Internal.SQLiteLocalStorage.CacheIdentity C# (CSharp) Метод

CacheIdentity() публичный Метод

cache the identity
public CacheIdentity ( string key, string identity ) : void
key string
identity string
Результат void
        public void CacheIdentity(string key, string identity)
        {
            string query = "INSERT INTO kvstore(key,value) values ( @key , @value )";
            try
            {
                connection = new SqliteConnection("URI=file:" + filePath);
                connection.Open();

                using (var command = connection.CreateCommand())
                {
                    command.CommandText = query;
                    BindData(command, key, identity);
                    command.ExecuteNonQuery();
                }
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                    connection.Dispose();
                }
            }
        }

Usage Example

 public override void CacheIdentityId(string identityId)
 {
     base.CacheIdentityId(identityId);
     using (var kvStore = new SQLiteLocalStorage())
     {
         kvStore.CacheIdentity(GetNamespacedKey(IDENTITY_ID_CACHE_KEY), identityId);
     }
 }