https://aka.ms/aspnetcore-makeover
- Intro (goals/non-goals/what you'll learn)
- Pick The Right Starting Template
- Web Application (no auth)
- Web API
- SPA
| // when T is any|unknown, Y is returned, otherwise N | |
| type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N; | |
| // when T is never, Y is returned, otherwise N | |
| type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N; | |
| // when T is a tuple, Y is returned, otherwise N | |
| // valid tuples = [string], [string, boolean], | |
| // invalid tuples = [], string[], (string | number)[] |
| # Git to autodetect text files and normalise their line endings to LF when they are checked into your repository. | |
| * text=auto | |
| # | |
| # The above will handle all files NOT found below | |
| # | |
| # These files are text and should be normalized (Convert crlf => lf) | |
| *.php text | |
| *.css text |
| ########################################################################## | |
| # Disable UAC (temporarily) | |
| ########################################################################## | |
| Disable-UAC | |
| ########################################################################## | |
| # Create temporary directory | |
| ########################################################################## |
| Get-NetTCPConnection | Group-Object -Property State, OwningProcess | Select -Property Count, Name, @{Name="ProcessName";Expression={(Get-Process -PID ($_.Name.Split(',')[-1].Trim(' '))).Name}}, Group | Sort Count -Descending |
https://aka.ms/aspnetcore-makeover
| /* | |
| <Query Kind="Program"> | |
| <NuGetReference>FsCheck.Xunit</NuGetReference> | |
| <NuGetReference>TypeShape</NuGetReference> | |
| <NuGetReference>xunit</NuGetReference> | |
| <NuGetReference>xunit.runner.utility</NuGetReference> | |
| <Namespace>FsCheck</Namespace> | |
| <Namespace>FsCheck.Xunit</Namespace> | |
| <Namespace>TypeShape</Namespace> | |
| <Namespace>TypeShape.Core</Namespace> |
| /* | |
| <Query Kind="Program"> | |
| <NuGetReference>xunit</NuGetReference> | |
| <NuGetReference>xunit.runner.utility</NuGetReference> | |
| <Namespace>Xunit</Namespace> | |
| <Namespace>Xunit.Runners</Namespace> | |
| <CopyLocal>true</CopyLocal> | |
| </Query> | |
| */ |
| using System.Linq; | |
| using ServiceStack; | |
| using ServiceStack.Text; | |
| using LanguageExt; | |
| using static LanguageExt.Prelude; | |
| using Newtonsoft.Json; | |
| public class Error : NewType<Error, string> | |
| { | |
| public Error(string value) : base(value) { } |
| using System.Linq; | |
| using ServiceStack; | |
| using ServiceStack.Text; | |
| using LanguageExt; | |
| using static LanguageExt.Prelude; | |
| using Newtonsoft.Json; | |
| public class Error : NewType<Error, string> | |
| { | |
| public Error(string value) : base(value) { } |
| public class Pattern<TReturn> | |
| : List<(Type Type, Func<object, TReturn> Map)> | |
| { | |
| public void Add<T>(Func<T, TReturn> map) | |
| => Add((typeof(T), o => map((T)o))); | |
| public Pattern<TReturn> Default(TReturn val) | |
| { | |
| Add((object _) => val); | |
| return this; |