当前位置: 首页>>代码示例>>C#>>正文


C# Conventions.NancyConventions类代码示例

本文整理汇总了C#中Nancy.Conventions.NancyConventions的典型用法代码示例。如果您正苦于以下问题:C# NancyConventions类的具体用法?C# NancyConventions怎么用?C# NancyConventions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NancyConventions类属于Nancy.Conventions命名空间,在下文中一共展示了NancyConventions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigureViewLocationConventions

        private static void ConfigureViewLocationConventions(NancyConventions conventions)
        {
            conventions.ViewLocationConventions = new List<Func<string, object, ViewLocationContext, string>>
            {
                (viewName, model, viewLocationContext) =>{
                    return string.IsNullOrEmpty(viewLocationContext.ModulePath) ? string.Empty : string.Concat("views/", viewLocationContext.ModulePath.TrimStart(new[] {'/'}), "/", viewName);
                },

                (viewName, model, viewLocationContext) => {
                    return string.Concat("views/", viewLocationContext.ModuleName, "/", viewName);
                },

                (viewName, model, viewLocationContext) =>{
                    return string.IsNullOrEmpty(viewLocationContext.ModulePath) ? string.Empty : string.Concat(viewLocationContext.ModulePath.TrimStart(new[] { '/' }), "/", viewName);
                },

                (viewName, model, viewLocationContext) => {
                    return string.Concat(viewLocationContext.ModuleName, "/", viewName);
                },

                (viewName, model, viewLocationContext) => {
                    return string.Concat("views/", viewName);
                },

                (viewName, model, viewLocationContext) => {
                    return viewName;
                },
            };
        }
开发者ID:ryanki1,项目名称:Nancy,代码行数:29,代码来源:DefaultViewLocationConventions.cs

示例2: ConfigureConventions

 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     base.ConfigureConventions(nancyConventions);
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("images"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("fonts"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("build"));
 }
开发者ID:DeanMcgarrigle,项目名称:SmartFlow,代码行数:7,代码来源:Bootstrapper.cs

示例3: ConfigureConventions

		protected override void ConfigureConventions(NancyConventions conventions) {
			base.ConfigureConventions(conventions);

			conventions.StaticContentsConventions.AddDirectory("/App");
			conventions.StaticContentsConventions.AddDirectory("/Fonts");
			conventions.StaticContentsConventions.AddDirectory("/Scripts");
		}
开发者ID:dealproc,项目名称:HalWithNancy,代码行数:7,代码来源:Bootstrapper.cs

示例4: Initialise

 /// <summary>
 /// Initialise any conventions this class "owns".
 /// </summary>
 /// <param name="conventions">Convention object instance.</param>
 public void Initialise(NancyConventions conventions)
 {
     conventions.StaticContentsConventions = new List<Func<NancyContext, string, Response>>
     {
         StaticContentConventionBuilder.AddDirectory("Content")
     };
 }
开发者ID:JulianRooze,项目名称:Nancy,代码行数:11,代码来源:DefaultStaticContentsConventions.cs

示例5: ConfigureConventions

 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     base.ConfigureConventions(nancyConventions);
     if (ConfigurationManager.AppSettings["Environment"] == "Debug") {
         nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddFile("/style2.css", "bin/style2.css"));
     }
 }
开发者ID:ralfw,项目名称:instavote.open,代码行数:7,代码来源:Bootstrapper.cs

示例6: ConfigureConventions

 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/Scripts", "Scripts"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/admin/Content", "/Areas/Admin/Content"));
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/admin/Scripts", "/Areas/Admin/Scripts"));
     base.ConfigureConventions(nancyConventions);
 }
开发者ID:tenacioussoftware,项目名称:techSerf,代码行数:7,代码来源:Bootstrapper.cs

示例7: ConfigureConventions

        protected override void ConfigureConventions(NancyConventions conventions)
        {
            base.ConfigureConventions(conventions);

            conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts"));
            conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("App"));
        }
开发者ID:NicoleMurphy,项目名称:ConfluxWritersDay,代码行数:7,代码来源:Bootstrapper.cs

示例8: ConfigureConventions

 protected override void ConfigureConventions(NancyConventions conventions)
 {
     conventions.ViewLocationConventions.Insert(0,
                                                (viewName, model, context) => string.Concat("Views/", viewName));
     conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts"));
     base.ConfigureConventions(conventions);
 }
开发者ID:pawelsawicz,项目名称:JustGiving.Film,代码行数:7,代码来源:NancyBootstrapper.cs

示例9: ConfigureConventions

 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     nancyConventions.StaticContentsConventions.Add(
         StaticContentConventionBuilder.AddDirectory("/assets")
     );
     base.ConfigureConventions(nancyConventions);
 }
开发者ID:wam3483,项目名称:WiFiServer,代码行数:7,代码来源:FormsAuthBootstrapper.cs

示例10: ConfigureConventions

        protected override void ConfigureConventions(NancyConventions nc)
        {
            nc.ViewLocationConventions.Add((viewName, model, context) =>
            {
                string modulePath = context.ModulePath;

                if (!string.IsNullOrWhiteSpace(modulePath) || modulePath.StartsWith("/"))
                    modulePath = modulePath.Remove(0, 1);

                return string.Concat(modulePath, "/Views/", context.ModuleName, "/", viewName);
            });

            nc.ViewLocationConventions.Add((viewName, model, context) =>
            {
                string modulePath = context.ModulePath;

                if (!string.IsNullOrWhiteSpace(modulePath) || modulePath.StartsWith("/"))
                    modulePath = modulePath.Remove(0, 1);

                return string.Concat(modulePath, "/Views/Shared/", viewName);
            });

            nc.ViewLocationConventions.Add((viewName, model, context) => string.Concat("Public/Views/", context.ModuleName, "/", viewName));
            nc.ViewLocationConventions.Add((viewName, model, context) => string.Concat("Public/Views/Shared/", viewName));
        }
开发者ID:philjones88,项目名称:NancyRazorPerformance,代码行数:25,代码来源:Bootstrapper.cs

示例11: ConfigureConventions

 protected override void ConfigureConventions(NancyConventions nancyConventions)
 {
     Console.Write("Configuring server conventions... ");
     base.ConfigureConventions(nancyConventions);
     nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("static", "static"));
     Console.WriteLine("Done.");
 }
开发者ID:Tyler-Darby,项目名称:Manbox,代码行数:7,代码来源:Bootstrapper.cs

示例12: ConfigureConventions

        protected override void ConfigureConventions(NancyConventions conventions)
        {
            base.ConfigureConventions(conventions);

              conventions.StaticContentsConventions.Add((ctx, root) =>
              {
            string fileName;
            if (ctx.Request.Path == "/vendor.js")
            {
              //return compressed version of vendor.js (as vendor.js.gz)
              fileName = Path.GetFullPath(Path.Combine(root, "Content", "vendor.js.gz"));
              if (File.Exists(fileName))
              {
            var response = new GenericFileResponse(fileName, ctx);
            response.Headers.Add("Content-Encoding", "gzip");
            response.Headers.Add("Content-Type", "application/javascript");
            return response;
              }
            }
            fileName = Path.GetFullPath(Path.Combine(root, "Content", (ctx.Request.Path == "/")?"index.html": ctx.Request.Path.Substring(1)));
            if (File.Exists(fileName))
            {
              return new GenericFileResponse(fileName, ctx);
            }
            return null;
              });
        }
开发者ID:BandwidthExamples,项目名称:csharp-web-sms-chat,代码行数:27,代码来源:Bootstrapper.cs

示例13: ConfigureConventions

        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);
            nancyConventions.StaticContentsConventions.Clear();

            nancyConventions.StaticContentsConventions.AddDirectory("Statics", "Statics");
        }
开发者ID:ujhs7380,项目名称:Project_JJK,代码行数:7,代码来源:Program.cs

示例14: ConfigureConventions

        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);

            // By default, Nancy will serve static content from the 'Content' folder. We want to add 'Scripts' as well.
            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("Scripts", "Scripts"));
        }
开发者ID:tleviathan,项目名称:nancy-owin-signalr-chat,代码行数:7,代码来源:Bootstrapper.cs

示例15: ConfigureConventions

 protected override void ConfigureConventions(NancyConventions conventions)
 {
     conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("css", @"Content/css"));
     conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("js", @"Content/js"));
     conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("img", @"Content/img"));
     base.ConfigureConventions(conventions);
 }
开发者ID:reositter,项目名称:David,代码行数:7,代码来源:NancyBootstrapper.cs


注:本文中的Nancy.Conventions.NancyConventions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。