public ProcessManagerAttachment(IQueryableDataStore dataStore) { if (dataStore == null) { throw new ArgumentNullException(nameof(dataStore)); } _dataStore = dataStore; }
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)); }
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)); }
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)); }
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()); }