protected override async Task SaveChangesInternal(Settings loaded) { AddTransactionCallback(() => new SettingsUpdated(loaded).Raise()); await _localCache.InsertObject("localSettings", loaded.Local); await _roamingCache.InsertObject("roamingSettings", loaded.Roaming); await _roamingSecureCache.InsertObject("secureSettings", loaded.Secure); }
public override async Task <bool> Migrate(List <Migration> migrations) { var key = "____migration_version"; var migrationId = await _cache.GetOrCreateObject(key, () => 0); var newMigrationId = migrations.Count; if (newMigrationId > migrationId) { foreach (var m in migrations.Skip(migrationId)) { await m.Migrate(this).ConfigureAwait(false); } // TODO: This should be a transaction :) await SaveChanges().ConfigureAwait(false); await _cache.InsertObject(key, newMigrationId); return(true); } return(false); }
public IObservable <Unit> SetObject <T>(string key, T value) => _localCache.InsertObject(key, value);