private static void SpaceXQueryExamples() { var spaceXContext = new QueryContext(); #region Company details var company = spaceXContext.Company().ToItem(); RenderCompanyDetails(company); #endregion #region Specific properties of company //Use an anonymous type to select specific properties var companySummaryAnonymous = spaceXContext.Company().Select(c => new { c.Ceo, c.Name, c.Headquarters }).ToItem(); //Use data class to select specific properties var companySummary = spaceXContext.Company().Select(c => new CompanySummary { Ceo = c.Ceo, Name = c.Name, Headquarters = c.Headquarters }).ToItem(); RenderCompanySummary(companySummary); #endregion #region Include navigation properties var companyWithHeadquartersAndLinks = spaceXContext.Company() .Include(info => info.Headquarters) .Include(info => info.Links).ToItem(); RenderCompanyDetailsAndLinks(companyWithHeadquartersAndLinks); #endregion #region Filter missions, compose queries var missionsQuery = spaceXContext.Missions(new MissionsFind { Manufacturer = "Orbital ATK" }, null, null) .Include(mission => mission.Manufacturers); var missions = missionsQuery.ToList(); RenderMissions(missions); var missionsWithPayloads = missionsQuery.Include(mission => mission.Payloads).ToList(); RenderMissions(missionsWithPayloads, true); #endregion #region Multiple levels of Includes //Launch_date_unix and Static_fire_date_unix need custom converter spaceXContext.ContractResolver = new SpaceXContractResolver(); var launches = spaceXContext.Launches(null, 10, 0, null, null) .Include(launch => launch.Links) .Include(launch => launch.Rocket) .Include(launch => launch.Rocket.Second_stage.Payloads.Select(payload => payload.Manufacturer)) .ToList(); RenderLaunches(launches); #endregion }