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.
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.
The odd part is that it is only incorrect on the front end. If I view the record via the CMS, it shows properly.
Some source 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<SiteContent> viewData = DB.SiteContents.OrderBy(c => 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 => c.ID == ID);
try
{
UpdateModel<SiteContent>(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 => c.Slug == strSlug);
return View(data);
}
}
* UPDATE * 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?
* UPDATE #2 * 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.