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


C# IAppBuilder.UseType方法代码示例

本文整理汇总了C#中IAppBuilder.UseType方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseType方法的具体用法?C# IAppBuilder.UseType怎么用?C# IAppBuilder.UseType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppBuilder的用法示例。


在下文中一共展示了IAppBuilder.UseType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configuration

        public void Configuration(IAppBuilder builder)
        {
            builder.UseAlpha("a", "b");

            builder.UseFunc(app => Alpha.Invoke(app, "a", "b"));

            builder.UseFunc(Alpha.Invoke, "a", "b");

            builder.Use(Beta.Invoke("a", "b"));

            builder.UseFunc(Beta.Invoke, "a", "b");

            builder.UseGamma("a", "b");

            builder.Use(typeof(Gamma), "a", "b");

            builder.UseType<Gamma>("a", "b");

            builder.UseFunc<AppFunc>(app => new Gamma(app, "a", "b").Invoke);

            builder.Use(typeof(Delta), "a", "b");

            builder.UseType<Delta>("a", "b");

            builder.UseFunc<AppFunc>(app => new Delta(app, "a", "b").Invoke);

            builder.Run(this);
        }
开发者ID:edoc,项目名称:owin-hosting,代码行数:28,代码来源:Startup.cs

示例2: Configuration

        public void Configuration(IAppBuilder builder)
        {
            builder.UseType<AddBreadCrumbMiddleware>("start-of-the-line");

            builder.MapPath("/branch1", builder1 =>
            {
                builder1.UseType<AddBreadCrumbMiddleware>("took-branch1");

                // Nesting paths, e.g. /branch1/branch2
                builder1.MapPath("/branch2", builder2 =>
                {
                    builder2.UseType<AddBreadCrumbMiddleware>("took-branch2");
                    builder2.UseType<DisplayBreadCrumbs>();
                });

                MapIfIE(builder1);
                builder1.UseType<DisplayBreadCrumbs>();
            });

            // Only full segments are matched, so /branch1 does not match /branch100
            builder.MapPath("/branch100", builder1 =>
            {
                builder1.UseType<AddBreadCrumbMiddleware>("took-branch100");
                builder1.UseType<DisplayBreadCrumbs>();
            });

            MapIfIE(builder);

            builder.UseType<AddBreadCrumbMiddleware>("no-branches-taken");
            builder.UseType<DisplayBreadCrumbs>();
        }
开发者ID:srihari-sridharan,项目名称:Programming-Playground,代码行数:31,代码来源:Startup.cs

示例3: NoStagesSpecified

 public void NoStagesSpecified(IAppBuilder app)
 {
     app.UseErrorPage();
     app.UseType<BreadCrumbMiddleware>("a", "PreHandlerExecute");
     app.UseType<BreadCrumbMiddleware>("b", "PreHandlerExecute");
     app.UseType<BreadCrumbMiddleware>("c", "PreHandlerExecute");
     app.Run((AppFunc)(environment =>
     {
         string fullBreadCrumb = environment.Get<string>("test.BreadCrumb", string.Empty);
         Assert.Equal("abc", fullBreadCrumb);
         return TaskHelpers.Completed();
     }));
 }
开发者ID:tkggand,项目名称:katana,代码行数:13,代码来源:IntegratedPipelineTests.cs

示例4: BadStagesSpecified

 public void BadStagesSpecified(IAppBuilder app)
 {
     app.UseErrorPage();
     app.UseType<BreadCrumbMiddleware>("a", "PreHandlerExecute");
     AddStageMarker(app, "Bad");
     app.UseType<BreadCrumbMiddleware>("b", "PreHandlerExecute");
     AddStageMarker(app, "Unknown");
     app.UseType<BreadCrumbMiddleware>("c", "PreHandlerExecute");
     AddStageMarker(app, "random 13169asg635rs4g3rg3");
     app.Run((AppFunc)(environment =>
     {
         string fullBreadCrumb = environment.Get<string>("test.BreadCrumb", string.Empty);
         Assert.Equal("abc", fullBreadCrumb);
         return TaskHelpers.Completed();
     }));
 }
开发者ID:tkggand,项目名称:katana,代码行数:16,代码来源:IntegratedPipelineTests.cs

示例5: Configuration

        public void Configuration(IAppBuilder app)
        {
            // app.UseFilter(req => req.TraceOutput.WriteLine(
            //    "{0} {1}{2} {3}",
            //    req.Method, req.PathBase, req.Path, req.QueryString));

            app.UseErrorPage();
            // app.Use(typeof(AutoTuneMiddleware), app.Properties["Microsoft.Owin.Host.HttpListener.OwinHttpListener"]);
            app.UseSendFileFallback();
            app.UseType<CanonicalRequestPatterns>();

            app.UseFileServer(opt => opt.WithPhysicalPath("Public"));

            app.MapPath("/static-compression", map => map
                .UseStaticCompression()
                .UseFileServer(opt =>
                {
                    opt.WithDirectoryBrowsing();
                    opt.WithPhysicalPath("Public");
                }));

            app.MapPath("/danger", map => map
                .UseStaticCompression()
                .UseFileServer(opt =>
                {
                    opt.WithDirectoryBrowsing();
                    opt.StaticFileOptions.ServeUnknownFileTypes = true;
                }));

            app.UseDiagnosticsPage("/testpage");
        }
开发者ID:tkggand,项目名称:katana,代码行数:31,代码来源:Startup.cs

示例6: Configuration

        public static void Configuration(IAppBuilder app)
        {
            var staticFileBasePath = Path.Combine(
                Directory.GetCurrentDirectory(),
                @"..\..\..\SignalR.Hosting.AspNet.Samples");

            Directory.SetCurrentDirectory(staticFileBasePath);

            ThreadPool.QueueUserWorkItem(_ =>
            {
                var context = GlobalHost.ConnectionManager.GetConnectionContext<Streaming>();
                var hubContext = GlobalHost.ConnectionManager.GetHubContext<DemoHub>();

                while (true)
                {
                    try
                    {
                        context.Connection.Broadcast(DateTime.Now.ToString());
                        hubContext.Clients.fromArbitraryCode(DateTime.Now.ToString());
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceError("SignalR error thrown in Streaming broadcast: {0}", ex);
                    }
                    Thread.Sleep(2000);
                }
            });

            app.MapHubs("/signalr");

            app.MapConnection<SendingConnection>("/sending-connection");
            app.MapConnection<TestConnection>("/test-connection");
            app.MapConnection<Raw>("/raw/raw");
            app.MapConnection<Streaming>("/streaming/streaming");

            app.UseType<RedirectFoldersWithoutSlashes>();
            app.UseType<DefaultStaticFileName>("index.htm");
            app.UseType<DefaultStaticFileName>("index.html");
            app.UseType<ExtensionContentType>(".htm", "text/plain");
            app.UseType<ExtensionContentType>(".html", "text/plain");
            app.UseStatic(staticFileBasePath);
        }
开发者ID:neiz,项目名称:SignalR,代码行数:42,代码来源:Startup.cs

示例7: Configuration

        public void Configuration(IAppBuilder app) {

            app.UseType<MyMiddleware>();
        }
开发者ID:RolandTG,项目名称:OwinSamples,代码行数:4,代码来源:Startup.cs

示例8: KnownStagesSpecified

 public void KnownStagesSpecified(IAppBuilder app)
 {
     app.UseErrorPage();
     app.UseType<BreadCrumbMiddleware>("a", "Authenticate");
     AddStageMarker(app, "Authenticate");
     app.UseType<BreadCrumbMiddleware>("b", "PostAuthenticate");
     AddStageMarker(app, "PostAuthenticate");
     app.UseType<BreadCrumbMiddleware>("c", "Authorize");
     AddStageMarker(app, "Authorize");
     app.UseType<BreadCrumbMiddleware>("d", "PostAuthorize");
     AddStageMarker(app, "PostAuthorize");
     app.UseType<BreadCrumbMiddleware>("e", "ResolveCache");
     AddStageMarker(app, "ResolveCache");
     app.UseType<BreadCrumbMiddleware>("f", "PostResolveCache");
     AddStageMarker(app, "PostResolveCache");
     app.UseType<BreadCrumbMiddleware>("g", "MapHandler");
     AddStageMarker(app, "MapHandler");
     app.UseType<BreadCrumbMiddleware>("h", "PostMapHandler");
     AddStageMarker(app, "PostMapHandler");
     app.UseType<BreadCrumbMiddleware>("i", "AcquireState");
     AddStageMarker(app, "AcquireState");
     app.UseType<BreadCrumbMiddleware>("j", "PostAcquireState");
     AddStageMarker(app, "PostAcquireState");
     app.UseType<BreadCrumbMiddleware>("k", "PreHandlerExecute");
     AddStageMarker(app, "PreHandlerExecute");
     app.Run((AppFunc)(environment =>
     {
         string fullBreadCrumb = environment.Get<string>("test.BreadCrumb", string.Empty);
         Assert.Equal("abcdefghijk", fullBreadCrumb);
         return TaskHelpers.Completed();
     }));
 }
开发者ID:tkggand,项目名称:katana,代码行数:32,代码来源:IntegratedPipelineTests.cs

示例9: Configuration

 public void Configuration(IAppBuilder app)
 {
     // TODO: Figure out how to not have this on all the time
     app.UseType<BasicAuthModule>("user", "password");
     app.MapHubs(new HubConfiguration());
 }
开发者ID:hallco978,项目名称:SignalR,代码行数:6,代码来源:BasicAuthApplication.cs


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