tevert / Mood

A simple moodboard. A webapp with 5 sad-happy faces, allowing quick and effortless feedback.
MIT License
1 stars 0 forks source link

Go back through and optimize the Owner <-> Survey Linq queries #37

Open tevert opened 7 years ago

tevert commented 7 years ago

At the start of this project, the pattern was:

var user = db.Users.FirstOrDefault(u => u.UserName == "whatever");
var surveys = db.Surveys.Where(s => s.Owner.UserName == user.UserName);

I've since added an OwnedSurveys collection to the User object, so we should be able to just .Include the surveys in the original DB hit.