ASP.NET MVC + S#arp Architectur + Spark View Engine - Can't use ActionLinkForAreas
I decided to use ASP.NET MVC, S#arp Architectur and the Spark View E开发者_如何学JAVAngine for my new project.
First i created a new project with the help of S#arp.
I tried to update the view of the S#arp Architectur to .spark files.
That works fine except for one exception left. The ActionLinkForAreas Method used in the Application.spark is not found in the HTMLHelper class:
error CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'ActionLinkForAreas' and no extension method 'ActionLinkForAreas' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
Call in Application.spark: ${Html.ActionLinkForAreas(c => c.Index(), "Home")}
The strange thing is it worked before i added the Spark View Engine
I would really appreciate your help
Just a guess, but I think you need to import the SharpArch.Web.Areas
namespace so that it can be used in the Spark files.
In your Spark configuration do something like this:
var settings = new SparkSettings();
settings.AddNamespace("SharpArch.Web.Areas");
engines.Add(new SparkViewFactory(settings));
You can also do it in the specific .spark file at the top:
<use namespace="SharpArch.Web.Areas" />
精彩评论