I have this method:
public CampaignCreative GetCampaignCreativeById(int id)
{
using (var db = GetContext())
{
Giving the compiler a hint by using IQueryable instead of var will work too.
IQueryable query = db.CampaignCreatives;
// or
DbQuery query = db.CampaignCreatives;
When using var the compiler infers DbSet for query which is more specific than the type returned by Include (which is DbQuery (=base class of DbSet) implementing IQueryable), so you can't assign the result to the query variable anymore. Hence the compiler error on the query = query.Include(include) line.