Esempio n. 1
0
 public async Task DeleteAsync <T>() where T : SmsSenderSettingsBase, new()
 {
     var partitionKey = SmsSenderSettingsEntity.GeneratePartitionKey();
     var defaultValue = SmsSenderSettingsBase.CreateDefault <T>();
     var rowKey       = SmsSenderSettingsEntity.GenerateRowKey(defaultValue);
     await _tableStorage.DeleteIfExistAsync(partitionKey, rowKey);
 }
Esempio n. 2
0
        public async Task <T> GetAsync <T>() where T : SmsSenderSettingsBase, new()
        {
            var partitionKey = SmsSenderSettingsEntity.GeneratePartitionKey();
            var defaultValue = SmsSenderSettingsBase.CreateDefault <T>();
            var rowKey       = SmsSenderSettingsEntity.GenerateRowKey(defaultValue);
            var entity       = await _tableStorage.GetDataAsync(partitionKey, rowKey);

            return(entity == null ? defaultValue : entity.GetSmsSenderSettings <T>());
        }
        public static SmsSenderSettingsEntity Create(SmsSenderSettingsBase settings)
        {
            var result = new SmsSenderSettingsEntity
            {
                PartitionKey = GeneratePartitionKey(),
                RowKey       = GenerateRowKey(settings),
            };

            result.SetSettings(settings);
            return(result);
        }
Esempio n. 4
0
 public async Task SetAsync <T>(T settings) where T : SmsSenderSettingsBase, new()
 {
     var newEntity = SmsSenderSettingsEntity.Create(settings);
     await _tableStorage.InsertOrReplaceAsync(newEntity);
 }