【问题标题】:Custom View folder in NancyFxNancyFx 中的自定义视图文件夹
【发布时间】:2015-05-01 03:30:34
【问题描述】:

我想在 NancyFx 中使用除 Views 以外的其他文件夹。我创建了一个自定义引导程序,它看起来像:

using Nancy;

namespace MyBootstrapperTest
{
    public class CustomBootstrapper : DefaultNancyBootstrapper
    {
        protected override void ConfigureConventions(Nancy.Conventions.NancyConventions nancyConventions)
        {
            nancyConventions.ViewLocationConventions.Add((viewName, model, context)) => string.Concat("html/", viewName));
        }
    }
}

但 Visual Studio 告诉我重载函数 ViewLocationConventions.Add 具有无效参数。我错过了什么吗?我对 Nancy 很陌生,在 0.21.1 版本中使用 Nancy 自托管。

【问题讨论】:

    标签: nancy


    【解决方案1】:

    您没有正确关闭括号。首先清除约定也很方便:

    nancyConventions.ViewLocationConventions.Clear();
    nancyConventions.ViewLocationConventions.Add((viewName, model, context) => 
        string.Concat("html/", viewName));
    

    【讨论】:

      猜你喜欢
      • 2014-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      相关资源
      最近更新 更多