Skip to content

Commit 64acafb

Browse files
committed
First sample, simpliest one. Adding assembly redirects as they are needed with MVC 4.0.
1 parent d2d4b7b commit 64acafb

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

DevTrends.MvcDonutCaching.Demo/Controllers/HomeController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ public class HomeController : Controller
1010
{
1111
//
1212
// GET: /Home/
13+
[DonutOutputCache(Duration = 24 * 3600)]
1314
public ActionResult Index()
1415
{
15-
return View();
16+
return View(DateTime.Now);
1617
}
1718
}
1819
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
@{
2-
ViewBag.Title = "title";
1+
@model DateTime
2+
@{
3+
ViewBag.Title = "Welcome to MvcDonutCaching demo";
34
}
45

56
<h2>@ViewBag.Title</h2>
7+
8+
<p>
9+
This page has been rendered at @Model
10+
</p>

DevTrends.MvcDonutCaching.Demo/Web.config

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,23 @@
5656

5757
<runtime>
5858
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
59+
<!--
60+
System.Web Assembly redirects are needed by MvcDonutCaching with MVC 4 (The library is linked against System.Web.Mvc 3.0)
61+
Without that, DonutCacheAttribute will be ignored.
62+
-->
63+
<dependentAssembly>
64+
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
65+
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
66+
</dependentAssembly>
67+
<dependentAssembly>
68+
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
69+
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
70+
</dependentAssembly>
71+
<dependentAssembly>
72+
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
73+
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
74+
</dependentAssembly>
75+
<!-- Added by Autofac -->
5976
<dependentAssembly>
6077
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
6178
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />

0 commit comments

Comments
 (0)