开发者

Spark can't find views

I have the following folder structure in an ASP.NET MVC 2 app using Spark.

 [site root]
    home
       HomeController.cs
    Views
       Shared
          Index.spark

However, if I move Index.spark 开发者_StackOverflowinto the /home folder, I get the following error:

The view 'Index' or its master was not found. The following locations were searched:
~/Views/Home/Index.aspx
~/Views/Home/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
Home\Index.spark
Shared\Index.spark

This is especially confusing because the file \home\index.spark does, in fact, exist. Any suggestions?

Moving index.spark into the /views/shared folder corrects the problem, but I don't want to cram all of my views into one folder.

update*

I modified DefaultDescriptorBuilder.cs in the Spark source:

   protected virtual IEnumerable<string> PotentialViewLocations(string controllerName, string viewName, IDictionary<string, object> extra)
    {
        return ApplyFilters(new[]
                                {
                                    "~/"+controllerName+"/"+viewName+".spark",
                                    controllerName + "\\" + viewName + ".spark",
                                    "Shared\\" + viewName + ".spark"
                                }, extra);
    }

by adding the line

                                    "~/"+controllerName+"/"+viewName+".spark",

which has corrected the problem. Anyone know if there is a way to do this other than modifying the source?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜