示例#1
0
        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);
        }
示例#3
0
 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();
 }
示例#4
0
 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();
 }