Beispiel #1
0
        /// <summary>
        /// This action, since it is not OutputCache'd will always execute, however the mExampleRepo.GetExamplePage(ID) will return a cached result based on the ID, until that node is updated
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public ActionResult IndexByID(int ID)
        {
            // This call will be cached automatically
            ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePage(ID);

            return(View("Index", ExamplePage));
        }
Beispiel #2
0
        // GET: Examples
        public ActionResult Index()
        {
            // This call will be cached automaticall since it is a ".Get_____"
            ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePages().FirstOrDefault();

            return(View(ExamplePage));
        }
Beispiel #3
0
        public ActionResult CachedActionByID(int ID, string SomeString)
        {
            // This call will be cached automatically and the cache dependency keys will be added automatically to the output cache
            ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePage(ID);

            // Add proper Cache Dependencies
            mOutputCacheDependencies.AddCacheItemDependency("CustomKey");
            return(View("CachedView", ExamplePage));
        }
Beispiel #4
0
        public ActionResult CachedView()
        {
            // This call will be cached automatically and the cache dependency keys will be added automatically to the output cache
            ExamplePageTypeModel ExamplePage = mExamplePageTypeRepo.GetExamplePages().FirstOrDefault();

            // Add a custom cache key
            mOutputCacheDependencies.AddCacheItemDependency("CustomKey");
            return(View(ExamplePage));
        }