IApplicationBuilderUsed to configure the application middleware pipelineMap() -> IApplicationBuilderMapWhen() -> IApplicationBuilderRun() -> voidUse() -> IApplicationBuilderUseMiddleware() -> IApplicationBuilderUsePathBase() -> IApplicationBuilderUseRouting() -> IApplicationBuilderUseRouter(Action<IRouteBuilder> action) -> IApplicationBuilderUseEndpointPoints() -> IApplicationBuilder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Numerics; | |
| using System.Text; | |
| using System.Text.Json; | |
| using System.Text.Unicode; | |
| var json = """ | |
| { | |
| "anInt": 123, | |
| "negativeInt": -123, | |
| "biggerInt": 1234567890, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ** Value Objects ** | |
| /user/123/posts?page=2&f=&q=test%20with%20spaces | |
| /user/123/posts/?page=2&f=&q=test%20with%20spaces | |
| user/123/posts?page=2 | |
| user/123/entity%20with%20spaces?page=2 | |
| /user/123?page=2 | |
| /user/123/posts?page=2 | |
| ** Ordinal ** | |
| /user/123/posts?page=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @page | |
| @model IndexModel | |
| @{ | |
| ViewData["Title"] = "Home page"; | |
| <div class="card"> | |
| <div class="card-body"> | |
| @await Model.GetInspirationalQuote() | |
| </div> | |
| <div class="card-footer"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Buffers; | |
| using System.Buffers.Text; | |
| using System.Diagnostics; | |
| using System.IO.Compression; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Running; | |
| BenchmarkRunner.Run<Benchmarks>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.AspNetCore.Authentication; | |
| using Microsoft.Extensions.Options; | |
| var builder = WebApplication.CreateBuilder(args); | |
| // Add services to the container. | |
| // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | |
| builder.Services.AddEndpointsApiExplorer(); | |
| builder.Services.AddSwaggerGen(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Put this in sub-directory of the project named 'assets' --> | |
| <Project> | |
| <Target Name="_ExtractVersionMetadata"> | |
| <WriteLinesToFile File="$(_ProjectVersionMetadataFile)" Lines="$(Version)" /> | |
| </Target> | |
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Buffers.Text; | |
| using System.Text; | |
| using System.Text.Json; | |
| using System.Text.Json.Serialization; | |
| using Microsoft.AspNetCore.Authentication; | |
| using Microsoft.AspNetCore.Authentication.JwtBearer; | |
| using Microsoft.AspNetCore.Authorization; | |
| using Microsoft.Extensions.Options; | |
| using Microsoft.OpenApi.Models; | |
| using Swashbuckle.AspNetCore.SwaggerGen; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.MapGroup("/apis", apis => | |
| { | |
| apis.UseExceptionHandler("/error"); | |
| var problemJsonMediaType = new MediaTypeHeaderValue("application/problem+json"); | |
| apis.MapGet("/error", (HttpContext context) => | |
| { | |
| // Get exception details | |
| var error = context.Features.Get<IExceptionHandlerFeature>()?.Error; | |
| var badRequestEx = error as BadHttpRequestException; |
NewerOlder