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


C# IApplicationBuilder.UseJson方法代码示例

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


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

示例1: Configure

 public void Configure(IApplicationBuilder app)
 {
     app.UsePlainText();
     app.UseJson();
     app.UseMvc();
 }
开发者ID:markrendle,项目名称:benchmarks,代码行数:6,代码来源:Startup.cs

示例2: Configure

        public void Configure(IApplicationBuilder app)
        {
            var kestrel = app.ServerFeatures[typeof(IKestrelServerInformation)] as IKestrelServerInformation;

            if (kestrel != null)
            {
                // Using an I/O thread for every 2 logical CPUs appears to be a good ratio
                kestrel.ThreadCount = Environment.ProcessorCount >> 1;
                kestrel.NoDelay = true;
            }

            app.UseErrorHandler();
            app.UsePlainText();
            app.UseJson();

            if (StartupOptions.EnableDbTests)
            {
                app.UseSingleQueryRaw(StartupOptions.ConnectionString);
                app.UseSingleQueryEf();
                var dbContext = (ApplicationDbContext)app.ApplicationServices.GetService(typeof(ApplicationDbContext));
                var seeder = (ApplicationDbSeeder)app.ApplicationServices.GetService(typeof(ApplicationDbSeeder));
                if (!seeder.Seed(dbContext))
                {
                    Environment.Exit(1);
                }
                Console.WriteLine("Database tests enabled");
            }

            app.UseMvc();

            app.Run(context => context.Response.WriteAsync("Try /plaintext instead"));
        }
开发者ID:thehousecat,项目名称:benchmarks,代码行数:32,代码来源:Startup.cs

示例3: Configure

        public void Configure(IApplicationBuilder app)
        {
            app.UseErrorHandler();
            app.UsePlainText();
            app.UseJson();

            if (StartupOptions.EnableDbTests)
            {
                app.UseSingleQueryRaw(StartupOptions.ConnectionString);
                app.UseSingleQueryDapper(StartupOptions.ConnectionString);
                app.UseSingleQueryEf();

                app.UseMultipleQueriesRaw(StartupOptions.ConnectionString);
                app.UseMultipleQueriesDapper(StartupOptions.ConnectionString);
                app.UseMultipleQueriesEf();

                app.UseFortunesRaw(StartupOptions.ConnectionString);
                app.UseFortunesDapper(StartupOptions.ConnectionString);
                app.UseFortunesEf();

                var dbContext = (ApplicationDbContext)app.ApplicationServices.GetService(typeof(ApplicationDbContext));
                var seeder = (ApplicationDbSeeder)app.ApplicationServices.GetService(typeof(ApplicationDbSeeder));
                if (!seeder.Seed(dbContext))
                {
                    Environment.Exit(1);
                }
                Console.WriteLine("Database tests enabled");
            }

            app.UseMvc();

            app.Run(context => context.Response.WriteAsync("Try /plaintext instead"));
        }
开发者ID:mgravell,项目名称:benchmarks,代码行数:33,代码来源:Startup.cs

示例4: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            // Configure the HTTP request pipeline.
            //app.UseStaticFiles();
            app.UseMvc();
            app.UseJson();
            app.UsePlainText();

            // Add MVC to the request pipeline.

            // Add the following route for porting Web API 2 controllers.
            // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
        }
开发者ID:JasonSoft,项目名称:aspnet5-benchmark,代码行数:14,代码来源:Startup.cs

示例5: Configure

        public void Configure(IApplicationBuilder app)
        {
            var kestrel = app.ServerFeatures[typeof(IKestrelServerInformation)] as IKestrelServerInformation;

            if (kestrel != null)
            {
                // BUG: Multi-loop Kestrel doesn't work on Windows right now, see https://github.com/aspnet/KestrelHttpServer/issues/232
                // kestrel.ThreadCount = 2;
            }

            app.UsePlainText();
            app.UseJson();
            app.UseMvc();
        }
开发者ID:schani,项目名称:benchmarks,代码行数:14,代码来源:Startup.cs

示例6: Configure

        public void Configure(IApplicationBuilder app, ApplicationDbSeeder dbSeeder, ApplicationDbContext dbContext)
        {
            if (Scenarios.Plaintext)
            {
                app.UsePlainText();
            }

            if (Scenarios.Json)
            {
                app.UseJson();
            }

            // Single query endpoints
            if (Scenarios.DbSingleQueryRaw)
            {
                app.UseSingleQueryRaw();
            }

            if (Scenarios.DbSingleQueryDapper)
            {
                app.UseSingleQueryDapper();
            }

            if (Scenarios.DbSingleQueryEf)
            {
                app.UseSingleQueryEf();
            }

            // Multiple query endpoints
            if (Scenarios.DbMultiQueryRaw)
            {
                app.UseMultipleQueriesRaw();
            }

            if (Scenarios.DbMultiQueryDapper)
            {
                app.UseMultipleQueriesDapper();
            }

            if (Scenarios.DbMultiQueryEf)
            {
                app.UseMultipleQueriesEf();
            }

            // Multiple update endpoints
            if (Scenarios.DbMultiUpdateRaw)
            {
                app.UseMultipleUpdatesRaw();
            }

            if (Scenarios.DbMultiUpdateDapper)
            {
                app.UseMultipleUpdatesDapper();
            }

            if (Scenarios.DbMultiUpdateEf)
            {
                app.UseMultipleUpdatesEf();
            }

            // Fortunes endpoints
            if (Scenarios.DbFortunesRaw)
            {
                app.UseFortunesRaw();
            }

            if (Scenarios.DbFortunesDapper)
            {
                app.UseFortunesDapper();
            }

            if (Scenarios.DbFortunesEf)
            {
                app.UseFortunesEf();
            }

            if (Scenarios.Any("Db"))
            {
                dbContext.Database.EnsureCreated();

                if (!dbSeeder.Seed())
                {
                    Environment.Exit(1);
                }
            }

            if (Scenarios.Any("Mvc"))
            {
                app.UseMvc();
            }

            if (Scenarios.StaticFiles)
            {
                app.UseStaticFiles();
            }

            app.RunDebugInfoPage();
        }
开发者ID:nathana1,项目名称:FrameworkBenchmarks,代码行数:98,代码来源:Startup.cs


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