Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Created September 4, 2019 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wullemsb/de9e5551ffd8e33b7606919b9d31fc26 to your computer and use it in GitHub Desktop.
Save wullemsb/de9e5551ffd8e33b7606919b9d31fc26 to your computer and use it in GitHub Desktop.
public class SampleContext: DbContext
{
public SampleContext(DbContextOptions<SampleContext> options)
: base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.Query<BlogDTO>().ToQuery(Blogs.Select(b => new BlogDTO { Name, Url });
//Removed other code
}
public DbSet<Blog> Blogs { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment