Exemple #1
0
        /// <summary>
        /// Loads one row cast per Query(T) or null
        /// </summary>
        public static TRow LoadRow <TRow>(this ICRUDOperations operations, Query <TRow> query) where TRow : Row
        {
            if (operations == null || query == null)
            {
                throw new NFXException(StringConsts.ARGUMENT_ERROR + "LoadRow(ICRUDOperations==null | query==null)");
            }

            return(operations.LoadOneRow(query) as TRow);
        }
Exemple #2
0
        /// <summary>
        /// Loads rowset with rows cast per Query(T) or empty enum
        /// </summary>
        public static IEnumerable <TRow> LoadEnumerable <TRow>(this ICRUDOperations operations, Query <TRow> query) where TRow : Row
        {
            if (operations == null || query == null)
            {
                throw new NFXException(StringConsts.ARGUMENT_ERROR + "LoadEnumerable(ICRUDOperations==null | query==null)");
            }

            return(operations.LoadOneRowset(query).AsEnumerableOf <TRow>());
        }
Exemple #3
0
        /// <summary>
        /// Loads one document cast per Query(T) or null
        /// </summary>
        public static TDoc LoadDoc <TDoc>(this ICRUDOperations operations, Query <TDoc> query) where TDoc : Doc
        {
            if (operations == null || query == null)
            {
                throw new AzosException(StringConsts.ARGUMENT_ERROR + "LoadDoc(ICRUDOperations==null | query==null)");
            }

            return(operations.LoadOneDoc(query) as TDoc);
        }
Exemple #4
0
        /// <summary>
        /// Async version - loads rowset with rows cast per Query(T) or empty enum
        /// </summary>
        public static Task <IEnumerable <TRow> > LoadEnumerableAsync <TRow>(this ICRUDOperations operations, Query <TRow> query) where TRow : Row
        {
            if (operations == null || query == null)
            {
                throw new NFXException(StringConsts.ARGUMENT_ERROR + "LoadEnumerableAsync(ICRUDOperations==null | query==null)");
            }

            return(operations.LoadOneRowsetAsync(query)
                   .ContinueWith <IEnumerable <TRow> >((antecedent) => antecedent.Result.AsEnumerableOf <TRow>()));
        }
Exemple #5
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));
        }
Exemple #6
0
        /// <summary>
        /// Async version - loads docset with rows cast per Query(T) or empty enum
        /// </summary>
        public static async Task <IEnumerable <TDoc> > LoadEnumerableAsync <TDoc>(this ICRUDOperations operations, Query <TDoc> query) where TDoc : Doc
        {
            if (operations == null || query == null)
            {
                throw new AzosException(StringConsts.ARGUMENT_ERROR + "LoadEnumerableAsync(ICRUDOperations==null | query==null)");
            }

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

            return(got.AsEnumerableOf <TDoc>());
        }
Exemple #7
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);
        }
Exemple #8
0
 public SymbolManager(Data.Context db, Config cfg) : base(db)
 {
     MaxResults  = cfg.MaxSymsPerPage;
     LangManager = new LangManager(db);
     TypeManager = new TypeManager(db);
 }