Esempio n. 1
0
        public Task DeleteAsync <T>(string traderId) where T : TraderSettingsBase, new()
        {
            var partitionKey = ClientSettingsEntity.GeneratePartitionKey(traderId);
            var defaultValue = TraderSettingsBase.CreateDefault <T>();
            var rowKey       = ClientSettingsEntity.GenerateRowKey(defaultValue);

            return(_tableStorage.DeleteAsync(partitionKey, rowKey));
        }
Esempio n. 2
0
        public async Task <T> GetSettings <T>(string traderId) where T : TraderSettingsBase, new()
        {
            var partitionKey = ClientSettingsEntity.GeneratePartitionKey(traderId);
            var defaultValue = TraderSettingsBase.CreateDefault <T>();
            var rowKey       = ClientSettingsEntity.GenerateRowKey(defaultValue);
            var entity       = await _tableStorage.GetDataAsync(partitionKey, rowKey);

            return(entity == null ? defaultValue : entity.GetSettings <T>());
        }