The .net SQLite wrapper is not perfect and lacks from many methods and functions. Especially the Where clause. It is not able to compile some expressions, so try to write them simpler as you can. For that, try the following:
var query = db.MediaItems.Where(x => x.LocationId == location.LocationId && x.Rating >= stars && (onlyLargePhotos == false || (onlyLargePhotos == true && (x.Width >= 2000 || x.Height >= 2000))));
BTW, why do you need to put the variable 'onlyLargePhotos' inside the where? It is not a variable and then the query could be divided. Just split your where in 2 wheres. Don't worry about the performance, both where's will be activated only on demand and not separately, something like that:
Func<MediaItem, bool> func;
if (onlyLargePhotos)
{
func = ((x => x.LocationId == location.LocationId && x.Rating >= stars) && ((x.Width >= 2000 || x.Height >= 2000)));
}
else
{
func = (x => x.LocationId == location.LocationId && x.Rating >= stars);
}
var query = db.MediaItems.Where(func)
Regarding the SQL generated, you can't see it.