/// <summary> /// Gets first value by key /// </summary> /// <param name="source"></param> /// <param name="tableName"></param> /// <param name="key"></param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public static async Task <Value> FindOneAsync(this IKeyValueStorage source, string tableName, Key key) { EnsureArg.IsNotNull(key, nameof(key)); var values = await source.FindAllAsync(tableName, key).AnyContext(); return(values.FirstOrDefault()); }
public static async Task <IEnumerable <T> > FindAllAsync <T>(this IKeyValueStorage source, Key key) where T : class, new() { var results = await source.FindAllAsync(typeof(T).Name.Pluralize(), key).AnyContext(); return(results.Select(r => { var instance = r.ToObject <T>(); MapKey(r, instance); return instance; })); }
public static async Task <IEnumerable <T> > FindAllAsync <T>(this IKeyValueStorage source, IEnumerable <Criteria> criterias) where T : class, new() { var results = await source.FindAllAsync(typeof(T).Name.Pluralize(), criterias).AnyContext(); return(results.Select(v => { var entity = v.ToObject <T>(); MapKey(v, entity); return entity; })); }
public static async Task <IEnumerable <T> > FindAllAsync <T>(this IKeyValueStorage source, string partitionKey, string rowKey) where T : class, new() { return(await source.FindAllAsync <T>(new Key(partitionKey, rowKey)).AnyContext()); }