make the edit work

used new QueryExtensions to save common trivial retrievings
added DbContextFactory