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
| 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; |
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
| // Now | |
| app.MapGet("/todos/{id}", async (int id, TodoDb db) => | |
| await db.Todos.FindAsync(id) | |
| is Todo todo | |
| ? Results.Ok(todo) | |
| : Results.NotFound()) | |
| .WithName("GetTodoById") | |
| .Produces<Todo>(StatusCodes.Status200OK) | |
| .Produces(StatusCodes.Status404NotFound); |
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
| // Ref: https://github.com/cston/csharplang/blob/DiscriminatedUnions/proposals/tagged-unions.md | |
| using System.ComponentModel.DataAnnotations; | |
| using Microsoft.EntityFrameworkCore; | |
| using MiniValidation; | |
| var builder = WebApplication.CreateBuilder(args); | |
| var connectionString = builder.Configuration.GetConnectionString("TodoDb") ?? "Data Source=todos.db"; | |
| builder.Services.AddSqlite<TodoDb>(connectionString); |
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
| function Get-ProgramFiles32() { | |
| if ($null -ne ${env:ProgramFiles(x86)}) { | |
| return ${env:ProgramFiles(x86)} | |
| } | |
| return $env:ProgramFiles | |
| } | |
| function Get-VsInstallLocation() { | |
| $programFiles = Get-ProgramFiles32 | |
| $vswhere = "$programFiles\Microsoft Visual Studio\Installer\vswhere.exe" |
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
| { | |
| "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
| "blocks": [ | |
| { | |
| "alignment": "left", | |
| "segments": [ | |
| { | |
| "foreground": "#f1184c", | |
| "properties": { | |
| "template": " \uf0e7 " |
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
| { | |
| "type": "text", // VS version | |
| "style": "powerline", | |
| "powerline_symbol": "\uE0C4", | |
| "foreground": "#ffffff", | |
| "background": "#5C2D91", // VS purple from https://visualstudio.microsoft.com/ | |
| "properties": { | |
| "prefix": "", | |
| "text": "{{if .Env.VSCMD_VER}} {{.Env.VSCMD_VER}} {{end}}", | |
| "postfix": "" |
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; | |
| using System.Linq; | |
| using System.Net.Http; | |
| using Microsoft.AspNetCore.Builder; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.AspNetCore.Hosting.Server; | |
| using Microsoft.AspNetCore.Hosting.Server.Features; | |
| using Microsoft.Extensions.DependencyInjection; | |
| using Microsoft.Extensions.Hosting; | |
| using Microsoft.Extensions.Logging; |
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
| #!/usr/bin/env dotnet run | |
| var builder = WebApplication.CreateBuilder(args); | |
| var config = builder.Configuration; | |
| var connString = config["connectionString"] ?? "Data Source=todos.db"; | |
| builder.AddDbContext<TodoDb>(options => options.UseSqlite(connString)); | |
| builder.AddSqlite<Todo>(connString) // Higher level API perhaps? | |
| var app = builder.Build(); |
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
| 2020-03-28 17:23:24,672 WARN 1 OutlookGoogleCalendarSync.OutlookOgcs.Calendar [0] - Sorry, something went wrong. You may want to try again. | |
| 2020-03-28 17:24:27,598 WARN 1 OutlookGoogleCalendarSync.Sync.PushSyncTimer [0] - Push Sync failed 3277 times to check for changed items. | |
| 2020-03-28 17:24:27,600 ERROR 1 OutlookGoogleCalendarSync.OGCSexception [0] - System.Runtime.InteropServices.COMException: Sorry, something went wrong. You may want to try again. | |
| 2020-03-28 17:24:27,601 ERROR 1 OutlookGoogleCalendarSync.OGCSexception [0] - Code: 0x85270057;-2061041577 | |
| 2020-03-28 17:24:55,940 WARN 1 OutlookGoogleCalendarSync.OutlookOgcs.Calendar [0] - Sorry, something went wrong. You may want to try again. | |
| 2020-03-28 17:24:59,851 WARN 1 OutlookGoogleCalendarSync.Sync.PushSyncTimer [0] - Push Sync failed 3278 times to check for changed items. | |
| 2020-03-28 17:24:59,851 ERROR 1 OutlookGoogleCalendarSync.OGCSexception [0] - System.Runtime.InteropServices.COMException: Sorry, something went wrong. You may want to |