當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。