I have 4 classes:
public class Section { public int SectionId { get; set; } public string Name { get; set; } public string Title { get; set; } public string MetaTag { get; set; } public string MetaDescription { get; set; } public string UrlSafe { get; set; } public string Header { get; set; } public string ImageName { get; set; } } public interface ISectionRepository { List<Section> GetAllSections(); } public class SectionRepository : ISectionRepository { Context context = new Context(); public List<Section> GetAllSections() { return context.Sections.ToList(); } } public class SectionApplication { SectionRepository sectionRepo = new SectionRepository(); public List<Section> GetAllSections() { return sectionRepo.GetAllSections(); } }
And in my controller, I have:
public class SectionController : Controller { SectionApplication sectionApp = new SectionApplication(); public ActionResult Index() { return View(sectionApp.GetAllSections()); } }
Now I want to do this: I want to read partitions in memory for a certain time, to read partitions from the cache, if it exists, and also read it from the database.
Hamid reza
source share