public IDistributedStoreKey GetBaseKey(DxStoreKeyAccessMode mode, DistributedStore.Context context) { if (this.IsRestartProcessOnDxStoreModeChange) { this.StartProcessRestartTimer(); } DistributedStoreKey compositeKey = new DistributedStoreKey(string.Empty, string.Empty, mode, context); compositeKey.IsBaseKey = true; try { this.ExecuteRequest(compositeKey, OperationCategory.GetBaseKey, OperationType.Read, string.Empty, delegate(IDistributedStoreKey key, bool isPrimary, StoreKind storeKind) { this.SetKeyByRole(compositeKey, isPrimary, this.BaseKeyGenerator(mode, context, storeKind)); }); } finally { if (compositeKey.PrimaryStoreKey == null) { compositeKey.CloseKey(); compositeKey = null; } } return(compositeKey); }
// Token: 0x060005A5 RID: 1445 RVA: 0x0001507C File Offset: 0x0001327C private IDistributedStoreKey OpenKeyFinal(string subKeyName, DxStoreKeyAccessMode mode, bool isIgnoreIfNotExist, ReadWriteConstraints constraints) { OperationCategory operationCategory = OperationCategory.OpenKey; OperationType operationType = OperationType.Read; if (mode == DxStoreKeyAccessMode.CreateIfNotExist) { operationCategory = OperationCategory.OpenOrCreateKey; operationType = OperationType.Write; } DistributedStoreKey compositeKey = new DistributedStoreKey(this.FullKeyName, subKeyName, mode, this.Context); IDistributedStoreKey result; try { result = (DistributedStore.Instance.ExecuteRequest <bool>(this, operationCategory, operationType, string.Format("SubKey: [{0}] Mode: [{1}] IsBestEffort: [{2}] IsConstrained: [{3}]", new object[] { subKeyName, mode, isIgnoreIfNotExist, constraints != null }), delegate(IDistributedStoreKey key, bool isPrimary, StoreKind storeKind) { this.ThrowIfKeyIsInvalid(key); IDistributedStoreKey distributedStoreKey = key.OpenKey(subKeyName, mode, isIgnoreIfNotExist, ReadWriteConstraints.Copy(constraints)); if (distributedStoreKey != null) { DistributedStore.Instance.SetKeyByRole(compositeKey, isPrimary, distributedStoreKey); return(true); } return(false); }) ? compositeKey : null); } finally { if (compositeKey.PrimaryStoreKey == null) { compositeKey.CloseKey(); } } return(result); }