public static async Task InsertAsync(this IKeyValueStorage source, string tableName, Value value) { EnsureArg.IsNotNullOrEmpty(tableName, nameof(tableName)); EnsureArg.IsNotNull(value, nameof(value)); await source.InsertAsync(new List <Value> { value }).AnyContext(); }
public async Task DeleteTable_CreateAndDelete_BackToPreviousState() { int tableNo1 = (await _tables.ListTableNamesAsync()).Count(); await _tables.InsertAsync(_tableName, new[] { new Value("pk", "rk") }); int tableNo2 = (await _tables.ListTableNamesAsync()).Count(); Assert.Equal(tableNo1 + 1, tableNo2); await _tables.DeleteAsync(_tableName); int tableNo3 = (await _tables.ListTableNamesAsync()).Count(); Assert.Equal(tableNo3, tableNo1); }
public static async Task InsertAsync <T>(this IKeyValueStorage source, T value) where T : class, new() { await source.InsertAsync(typeof(T).Name.Pluralize(), Map(value)).AnyContext(); }
public static async Task InsertAsync <T>(this IKeyValueStorage source, IEnumerable <T> values) where T : class, new() { await source.InsertAsync(typeof(T).Name.Pluralize(), values.Safe().Select(Map)).AnyContext(); }