Skip to content

Instantly share code, notes, and snippets.

View edgamat's full-sized avatar

Matt Edgar edgamat

View GitHub Profile
@edgamat
edgamat / ps1
Created March 4, 2024 09:02
PowerShell script to create a new dotnet solution (.NET 8.0.1)
param (
[string]$projectName
)
mkdir "$projectName"
# Ensure the SDK is locked in so the solution is independent of other SDK versions
cd "$projectName"
dotnet new globaljson --sdk-version 8.0.101 --roll-forward minor
dotnet new editorconfig
@edgamat
edgamat / gist:ffdc7f185a12207bffdbd02d2442032d
Created August 3, 2020 09:19
Rename your Git default branch from master to main
git branch -m master main
git push -u origin main
@edgamat
edgamat / cloudSettings
Created March 26, 2019 10:31
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-03-26T10:31:11.194Z","extensionVersion":"v3.2.7"}
@edgamat
edgamat / EF.QueryClientEvaluationWarning
Last active December 27, 2018 10:29
How to configure QueryClientEvaluationWarning for EF Core
https://saebamini.com/the-dangerous-ef-core-feature-automatic-client-evaluation/
When using EF Core, the default configuration will not warn you (with a runtime error) if you
are using a Linq query that EF Core cannot evaluate. This will result in the query being
run in a manner that might not be as expected. For example:
var query = context.Set<Blog>().Where(x => x.Url.Equals("google.com/", StringComparison.OrdinalIgnoreCase));
var results = query.ToList();
The overloaded Equals method with the StringComparison argument is not something EF Core understands. As
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="StyleCop Rules" Description="Code analysis rules" ToolsVersion="14.0">
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1009" Action="None" />
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1200" Action="None" />
<Rule Id="SA1111" Action="None" />
<Rule Id="SA1116" Action="None" />
<Rule Id="SA1117" Action="None" />
<Rule Id="SA1118" Action="None" />
@edgamat
edgamat / StyleCop.md
Last active September 27, 2018 20:16
Instructions for adding StyleCop to a .NET Core project

How to use StyleCop in .NET Core

Step 1: Add the StyleCop.Analyzers (nuget) package:

> dotnet add package StyleCop.Analyzers

Step 2: Add an empty file to the project called StyleCop.ruleset.