Ejemplo n.º 1
0
        /// <summary>
        /// Gets first value by partitionkey and rowkey
        /// </summary>
        /// <param name="source"></param>
        /// <param name="tableName"></param>
        /// <param name="partitionKey"></param>
        /// <param name="rowKey"></param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public static async Task <Value> FindOneAsync(this IKeyValueStorage source, string tableName, string partitionKey, string rowKey)
        {
            EnsureArg.IsNotNullOrEmpty(partitionKey, nameof(partitionKey));
            EnsureArg.IsNotNullOrEmpty(rowKey, nameof(rowKey));

            return(await source.FindOneAsync(tableName, new Key(partitionKey, rowKey)).AnyContext());
        }
Ejemplo n.º 2
0
        public static async Task <T> FindOneAsync <T>(this IKeyValueStorage source, Key key)
            where T : class, new()
        {
            var result = await source.FindOneAsync(typeof(T).Name.Pluralize(), key).AnyContext();

            var instance = result.ToObject <T>();

            MapKey(result, instance);
            return(instance);
        }
Ejemplo n.º 3
0
 public static async Task <T> FindOneAsync <T>(this IKeyValueStorage source, string partitionKey, string rowKey)
     where T : class, new()
 {
     return(await source.FindOneAsync <T>(new Key(partitionKey, rowKey)).AnyContext());
 }