I am fairly new to Entity Framework and I am not sure I am really using it to it's max potential. I have this query, that IMHO seems to take a little longer than I feel it should. I have tried various combinations to retrieve all the data I need making as few connections as possible and so far this query yeilds the best results with an average of about 320 ms. Is there anything I can do to make this query faster?
Something to note is that the include for Awe_PageContainerBlurb is a many-to-many relationship based on 3 tables.
var roles = from role in db.aspnet_Roles join userRole in db.aspnet_UsersInRoles on role.RoleId equals userRole.RoleId where userRole.UserId == userID select role; var awePageData = ((ObjectQuery<Awe_Page>)(from page in db.AweBjects.OfType<Awe_Page>() join app in db.aspnet_Applications on page.ApplicationId equals app.ApplicationId where app.ApplicationName == user.ApplicationName && page.Active && page.Name == pageName from pageRole in page.aspnet_Roles where roles.Contains(pageRole) select page)) .Include("Awe_PageContainerBlurb.Awe_Container") .Include("Awe_PageContainerBlurb.Awe_Blurb"); var menuItems = from menu in db.AweBjects.OfType<Awe_Menu>() join app in db.aspnet_Applications on menu.ApplicationId equals app.ApplicationId where app.ApplicationName == user.ApplicationName && menu.Active from menuRole in menu.aspnet_Roles where roles.Contains(menuRole) select menu;