Esempio n. 1
0
        /// <summary>
        /// Async version - loads one doc cast per Query(T) or null
        /// </summary>
        public static Task <TDoc> LoadDocAsync <TDoc>(this ICRUDOperations operations, Query <TDoc> query) where TDoc : Doc
        {
            if (operations == null || query == null)
            {
                throw new AzosException(StringConsts.ARGUMENT_ERROR + "LoadDocAsync(ICRUDOperations==null | query==null)");
            }

            return(operations.LoadOneDocAsync(query)
                   .ContinueWith <TDoc>((antecedent) => antecedent.Result as TDoc));
        }
Esempio n. 2
0
        /// <summary>
        /// Async version - loads one doc cast per Query(T) or null
        /// </summary>
        public static async Task <TDoc> LoadDocAsync <TDoc>(this ICRUDOperations operations, Query <TDoc> query) where TDoc : Doc
        {
            if (operations == null || query == null)
            {
                throw new AzosException(StringConsts.ARGUMENT_ERROR + "LoadDocAsync(ICRUDOperations==null | query==null)");
            }

            var got = await operations.LoadOneDocAsync(query).ConfigureAwait(false);

            return(got as TDoc);
        }