Пример #1
0
 /// <inheritdoc/>
 public Task <Maybe <IEnumerable <T> > > ExecuteAsync <T>(
     IWpDb db,
     IUnitOfWork w,
     GetPostsOptions opt,
     params IContentFilter[] filters
     )
     where T : IWithId <WpPostId> =>
 QueryPostsF.ExecuteAsync <T>(db, w, opt, filters);
Пример #2
0
 /// <inheritdoc/>
 public Task <Maybe <IPagedList <T> > > ExecuteAsync <T>(
     IWpDb db,
     IUnitOfWork w,
     ulong page,
     GetPostsOptions opt,
     params IContentFilter[] filters
     )
     where T : IWithId <WpPostId> =>
 QueryPostsF.ExecuteAsync <T>(db, w, page, opt, filters);
Пример #3
0
 /// <summary>
 /// Get query parts using the specific options
 /// </summary>
 /// <typeparam name="TModel">Return value type</typeparam>
 /// <param name="db">IWpDb</param>
 /// <param name="opt">Function to return query options</param>
 internal static Maybe <IQueryParts> GetQueryParts <TModel>(IWpDb db, GetPostsOptions opt)
     where TModel : IWithId <WpPostId> =>
 F.Some(
     () => opt(new PostsOptions(db.Schema)),
     e => new M.ErrorGettingQueryPostsOptionsMsg(e)
     )
 .Bind(
     x => x.ToParts <TModel>()
     );
Пример #4
0
 /// <inheritdoc cref="ExecuteAsync{TModel}(IWpDb, IUnitOfWork, ulong, GetPostsOptions, IContentFilter[])"/>
 internal static Task <Maybe <IEnumerable <TModel> > > ExecuteAsync <TModel>(
     IWpDb db,
     IUnitOfWork w,
     GetPostsOptions opt,
     params IContentFilter[] filters
     )
     where TModel : IWithId <WpPostId> =>
 GetQueryParts <TModel>(
     db, opt
     )
 .BindAsync(
     x => db.Query.QueryAsync <TModel>(x, w.Transaction)
     )
 .BindAsync(
 /// <summary>
 /// Get Previous and Next posts, if they exist, for the specified query options
 /// </summary>
 /// <param name="db">IWpDb</param>
 /// <param name="w">IUnitOfWork</param>
 /// <param name="currentId">Current Post ID</param>
 /// <param name="opt">Function to return query options</param>
 internal static Task <Maybe <(WpPostId?prev, WpPostId?next)> > GetPreviousAndNextAsync(
     IWpDb db,
     IUnitOfWork w,
     WpPostId currentId,
     GetPostsOptions opt
     ) =>