public async Task <object> GetStateAsync(string stateId, CancellationToken cancellationToken) { object stateValue = null; try { var settings = await _settingsProvider.GetSettings(); var recordKey = GetRecordKey(settings, stateId); var client = GetClient(settings); var record = await client.Get(null, cancellationToken, recordKey); if (record == null || !record.bins.TryGetValue(Keystore.AerospikeKeys.BinNames.ObjectState, out stateValue)) { recordKey = GetAlertnateRecordKey(settings, stateId); record = await client.Get(null, cancellationToken, recordKey); if (record == null || !record.bins.TryGetValue(Keystore.AerospikeKeys.BinNames.ObjectState, out stateValue)) { return(null); } } } catch (Exception ex) { throw new AerospikeProviderException(Keystore.AerospikeKeys.Errors.AerospikeOperationError, ex); } using (new ProfileContext("State deserialization")) return(_serializationFacade.Deserialize <object>((byte[])stateValue)); }
public T FromFormatted <T>(byte[] array) { return(_serializationFacade.Deserialize <T>(array)); }