Tag:core

  • String of algorithm — longest palindrome substring

    Time:2020-11-28

    Longest Palindromic Substring difficultysecondaryGiven a strings, foundsThe longest palindrome string in. You can assume thatsThe maximum length of is 1000. as everyone knows,Palindrome substring is a certain axis as the center, left and right mirror symmetryHow to find the longest palindrome substring in S? 1. Violent cracking Brute force cracking is the most easy way […]

  • ASP.NET Problems and solutions of middleware with initial parameters in core 2.0

    Time:2020-11-28

    problem How to ASP.NET Core 2.0 passes initial parameters to middleware? answer In an empty project, create a poco (plain old CLR object) to save the required parameters of middleware: public class GreetingOptions { public string GreetAt { get; set; } public string GreetTo { get; set; } } Add a middleware: public class GreetingMiddleware […]

  • Apicloud developer’s way to advance | [case source code] simple timeline

    Time:2020-11-26

    Based on the needs of business, I made a simple timeline example. I found the color on the Internet and put the picture first. Because you want to make a transparent header, the header of the win page will be covered after the frm page is opened on the win page. Therefore, the header label […]

  • Talking about ASP.NET Core 2.0 Middleware

    Time:2020-11-26

    problem How to create the simplest ASP.NET Core middleware? answer Use VS to create a ASP.NET Empty project of core 2.0, please note Startup.cs Configure() method in: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.Run(async (context) => { await context.Response.WriteAsync(“Hello World! (Run)”); }); } A better way to create a request pipeline is to use […]

  • Talking about ASP.NET Core 2.0 middleware with initial parameters

    Time:2020-11-25

    problem How to ASP.NET Core 2.0 passes initial parameters to middleware? answer In an empty project, create a poco (plain old CLR object) to save the required parameters of middleware: public class GreetingOptions { public string GreetAt { get; set; } public string GreetTo { get; set; } } Add a middleware: public class GreetingMiddleware […]

  • Detailed explanation ASP.NET Framework level dependency injection in core

    Time:2020-11-23

    1、 ASP.NET Dependency injection in core This example shows how framework level dependency injection works in ASP.NET Working in the core. It is simple but powerful enough to do most of the work of dependency injection. Framework level dependency injection supports the following scopes: Singleton – always returns the same instance Transient – returns a […]

  • [translation] ASP.NET How to redirect the core 2.0 web address

    Time:2020-11-20

    problem How to ASP.NET URL redirection in core 2.0? answer Create an empty project in Startup.cs In the rewriter options, add the middleware URL: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var rewrite = new RewriteOptions() .AddRedirect(“films”, “movies”) .AddRewrite(“actors”, “stars”, true); app.UseRewriter(rewrite); app.Run(async (context) => { var path = context.Request.Path; var query = context.Request.QueryString; await […]

  • ASP.NET Core 2.0 local file operation problems and Solutions

    Time:2020-11-19

    problem How to ASP.NET Limited access to local directory and file information in core 2.0? answer Create an empty project, modify the startup class, and add the services needed to access local files public void ConfigureServices(IServiceCollection services) { services.AddSingleton<IFileProvider>( new PhysicalFileProvider(Directory.GetCurrentDirectory())); } Create a middleware, read all the files in the root directory, and output […]

  • ASP.NET Unit testing using xUnit in core

    Time:2020-11-18

    Since the birth of the first version of MVC, the function of unit testing has been introduced as an important selling point. When comparing MVC with webform, unit testing is always playing cards and crushing webform to nothing. There is no need to say much about the importance of unit testing. For projects with unit […]

  • [translation] ASP.NET Core 2.0 routing engine details

    Time:2020-11-17

    This paper introduces the ASP.NET 2. Details of the core are as follows: problem ASP.NET How does the routing engine of core 2.0 work? answer Create an MVC middleware and an empty service class public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseMvc(routes => { routes.MapRoute( name: “goto_one”, template: […]

  • Talking about ASP.NET Core middleware realizes distributed session

    Time:2020-11-16

    1.1. Middleware principle 1.1.1. What is middleware Middleware is a piece of code used to process requests and responses. Usually, multiple middleware are linked together to form a pipeline. Each middleware decides whether to call the next middleware or not. 1.1.2. Middleware execution process Take an example to demonstrate the execution process of Middleware (there […]

  • Detailed explanation ASP.NET Core 2.0 view engine

    Time:2020-11-15

    problem How to ASP.NET Using the razor engine to create views in core 2.0? answer Create an empty item, modify Startup.cs Add MVC service and request middleware public void ConfigureServices(IServiceCollection services) { services.AddMvc(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(routes => { routes.MapRoute( name: “default”, template: “{controller=Home}/{action=Index}/{id?}”); }); […]