Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET/MVC2 data caching using Entity Data Models
    primarykey
    data
    text
    <p>I am having a strange caching problem and I believe it might be related to the fact that I am using a Entity Data Model as my data source.</p> <p>The problem is that I can update the database directly and it doesn't reflect on the actual site until I republish the project. The data does display properly when viewing the project locally.</p> <p>The odd part is that it is only incorrect on the front end. If I view the record via the CMS, it shows properly.</p> <p>Some source code:</p> <pre><code>// *** CMS CONTROLLER *** [HandleError] public class SiteManagerController : Controller { static DataModel DB = new DataModel(); // via CMS Controller // CMS - Get the data *** PULLS DATA CORRECTLY public ActionResult Content() { List&lt;SiteContent&gt; viewData = DB.SiteContents.OrderBy(c =&gt; c.Title).ToList(); return View(viewData); } // via CMS Controller // CMS - Update logic [HttpPost] [ValidateInput(false)] public ActionResult ContentEdit(int ID, FormCollection formValues) { SiteContent siteContent = DB.SiteContents.Single(c =&gt; c.ID == ID); try { UpdateModel&lt;SiteContent&gt;(siteContent); DB.SaveChanges(); return RedirectToAction("Content"); } catch { throw; } } } // *** HOME CONTROLLER *** [HandleError] public class HomeController : Controller { static DataModel DB = new DataModel(); [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")] public ActionResult Index(string strSlug) { data = DietCenterDB.SiteContents.Single(c =&gt; c.Slug == strSlug); return View(data); } } </code></pre> <p><strong>* UPDATE *</strong> It seems that there is some sort of timed delay associated with this issue. If I update the CMS/database everything functions properly after 15-20 minutes. Perhaps some object related to the front end data access needs to timeout or expire in order to grab the new content?</p> <p><strong>* UPDATE #2 *</strong> It seems that it's only the varchar/text fields that aren't updating properly. If I change an int field, it updates properly and the information is changed on every page.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload