示例#1
0
        public ProcessManagerAttachment(IQueryableDataStore dataStore)
        {
            if (dataStore == null)
            {
                throw new ArgumentNullException(nameof(dataStore));
            }

            _dataStore = dataStore;
        }
示例#2
0
        public static IAsyncEnumerable <TData> GetAllAsync <TData>(this IQueryableDataStore dataStore,
                                                                   CancellationToken cancellation = default)
        {
            if (dataStore == null)
            {
                throw new ArgumentNullException(nameof(dataStore));
            }

            return(dataStore.QueryAsync <TData, TData>(p => p, cancellation));
        }
        public static IAsyncEnumerable <TData> QueryAsync <TData>(this IQueryableDataStore dataStore, Func <IQueryable <TData>, IQueryable <TData> > queryShaper, CancellationToken cancellation = default)
            where TData : class
        {
            if (dataStore == null)
            {
                throw new ArgumentNullException(nameof(dataStore));
            }

            if (queryShaper == null)
            {
                throw new ArgumentNullException(nameof(queryShaper));
            }

            return(dataStore.QueryAsync(queryShaper, cancellation));
        }
示例#4
0
        public static IAsyncEnumerable <TData> GetByAsync <TData>(this IQueryableDataStore dataStore,
                                                                  Expression <Func <TData, bool> > predicate,
                                                                  CancellationToken cancellation = default)
        {
            if (dataStore == null)
            {
                throw new ArgumentNullException(nameof(dataStore));
            }

            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }

            return(dataStore.QueryAsync <TData, TData>(p => p.Where(predicate), cancellation));
        }
示例#5
0
        public static IAsyncEnumerable <TResult> GetAllAsync <TData, TResult>(this IQueryableDataStore dataStore,
                                                                              Expression <Func <TData, TResult> > projection,
                                                                              CancellationToken cancellation = default)
        {
            if (dataStore == null)
            {
                throw new ArgumentNullException(nameof(dataStore));
            }

            if (projection == null)
            {
                throw new ArgumentNullException(nameof(projection));
            }

            return(dataStore.QueryAsync <TData, TResult>(p => p.Select(projection), cancellation));
        }
示例#6
0
        public static Task <TResult> GetSingleAsync <TData, TResult>(this IQueryableDataStore dataStore,
                                                                     Expression <Func <TData, bool> > predicate,
                                                                     Expression <Func <TData, TResult> > projection,
                                                                     CancellationToken cancellation = default)
        {
            if (dataStore == null)
            {
                throw new ArgumentNullException(nameof(dataStore));
            }

            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }

            if (projection == null)
            {
                throw new ArgumentNullException(nameof(projection));
            }

            return(dataStore.QueryAsync <TData, TResult>(p => p.Where(predicate).Select(projection), cancellation).FirstOrDefault());
        }