Skip to content

Instantly share code, notes, and snippets.

View MareMare's full-sized avatar
🌴
On vacation

MareMare MareMare

🌴
On vacation
View GitHub Profile
@MareMare
MareMare / Building a project that target .NET Framework 4.5 in Visual Studio 2022.md
Last active December 23, 2022 07:43
Building a project that target .NET Framework 4.5 in Visual Studio 2022
@stknohg
stknohg / Install-LatestWinGet.ps1
Last active June 25, 2024 03:55
Windows Server 2022にWindows Terminal, WinGetをインストールする関数
function Install-LatestWinGet ([switch]$SkipInstallVCLibs) {
# Install prerequisites
if (-not $SkipInstallVCLibs) {
$vcLibsUrl = 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
Write-Host -ForegroundColor Green "Download $vcLibsUrl"
Add-AppxPackage -Path $vcLibsUrl
}
# Find the latest assets url
$latest = Invoke-RestMethod -Uri 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
@davidfowl
davidfowl / .NET6Migration.md
Last active July 19, 2024 22:48
.NET 6 ASP.NET Core Migration
@davidfowl
davidfowl / MinimalAPIs.md
Last active June 28, 2024 17:42
Minimal APIs at a glance
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@RickStrahl
RickStrahl / ColorConsole.cs
Last active March 30, 2024 16:00
Color Console - a simple class to add color to .NET Console commands more easily.
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace MainColorConsole
{
class Program
{
static void Main(string[] args)
{
@minop1205
minop1205 / conventional-commits.md
Last active June 21, 2024 15:28
コミットメッセージ規約
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"copyOnSelect": false,
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
@palmerandy
palmerandy / BaseRepository.cs
Last active June 14, 2024 08:52
C# SQL Database pagination sample using Dapper ORM.
using System;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
namespace Samples
{
public abstract class BaseRepository
{
protected async Task<T> DbAction<T>(Func<IDbConnection, Task<T>> action, string connectionString = null)
@yfakariya
yfakariya / MicrosoftExtensionsDependencyInjectionDeepDive.md
Created November 4, 2019 11:47
Deep dive of Microsoft.Extensions.DependencyInjection in Japanese

Microsoft.Extensions.DependencyInjection Deep Dive

そんなに深くない気がしますが。Microsoft.Extensions.DependencyInjection の DI についてざっくりまとめた記事です。なお、長いので、Microsoft.Extensions.DependencyInjectionM.E.DI と略します。

例によって、公式ドキュメント にすべて書いてある、はずですが、ここでは少し別の観点でまとめてみます。また、ドキュメントに書いてない(と思う)内部実装についてもいくつか書いてあります。

使い方

  • IServiceCollection の拡張メソッドを使用して、フレームワークやランタイムが提供する IServiceCollection の実装に対して登録していきます。
  • IServiceCollectionServiceDescriptor というサービスについてのスペックを表すオブジェクトのコレクションである。ServiceDescriptor はサービス型をキーにして、ライフタイムと実装を持ちます。