Skip to content

Instantly share code, notes, and snippets.

@LANSELOT
Created August 1, 2020 13:35
Show Gist options
  • Save LANSELOT/905973aa495ef43754fd2cd6b2387d11 to your computer and use it in GitHub Desktop.
Save LANSELOT/905973aa495ef43754fd2cd6b2387d11 to your computer and use it in GitHub Desktop.
postsQueryable =
context.Posts
.Include(x => x.Section)
.Include(x => x.PostTags).ThenInclude(x => x.Tag)
.Where(x => x.IsPublished)
.Select(x => new Post
{
Title = x.Title,
Slug = x.Slug,
Cover = x.Cover,
ContentShort = x.ContentShort,
CreatedDate = x.CreatedDate,
SectionId = x.SectionId,
Section = x.Section,
IsPublished = x.IsPublished,
PostTags = x.PostTags,
SeoTitle = x.SeoTitle,
SeoKeywords = x.SeoKeywords,
SeoDescription = x.SeoDescription,
}).OrderBy(on => on.CreatedDate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment