public VacationDataSource() { var data = EmbeddedResource.GetStream("VacationSpots.Common.Data.VacationData.xml"); XDocument doc = XDocument.Load(data); if (doc.Root != null) { foreach (XElement category in doc.Root.Elements("category")) { var vacationCategory = new VacationCategory( category.Attribute("id").Value, category.Attribute("title").Value, category.Attribute("subtitle").Value, category.Attribute("image").Value, category.Attribute("description").Value); allCategories.Add(vacationCategory); foreach (XElement trip in category.Elements("destination")) { var item = new VacationItem( trip.Attribute("id").Value, trip.Attribute("title").Value, trip.Attribute("subtitle").Value, trip.Attribute("image").Value, trip.Value) { CategoryOwner = vacationCategory }; vacationCategory.Items.Add(item); allVacations.Add(item); } } } }
public override Stream Open() { if (cacheControl != null) { HttpContext.Current.Response.Cache.SetCacheability(cacheControl.Cacheability); HttpContext.Current.Response.Cache.AppendCacheExtension("max-age=" + cacheControl.MaxAge); } return(embedded.GetStream()); }