In Entity Framework Core (2.2+) if you’re capturing queries in logs consider using the TagWith feature to output an arbitrary … Continue reading Labelling Entity Framework Core queries in log files using TagWith
How to cycle through the clipboard ring in SQL Server Management Studio
Posted this before about Visual Studio, but in SQL Server Management Studio, CTRL+V will paste the LAST COPIED item but … Continue reading How to cycle through the clipboard ring in SQL Server Management Studio
Visual Studio constructor creation shortcuts
Visual Studio has shortcuts for almost everything. Getting to know even some of these can save you a lot of … Continue reading Visual Studio constructor creation shortcuts
Close the console window when debugging stops in Visual Studio
Visual Studio by default will keep a console app open after debugging. A lot of the time after debugging console … Continue reading Close the console window when debugging stops in Visual Studio
How to filter the object list in SQL Server Management Studio
In SQL Server Management Studio to filter your tables, views, stored procedures etc. list right click on the object type … Continue reading How to filter the object list in SQL Server Management Studio
How to select and edit multiple lines at once in Visual Studio
In Visual Studio to edit multiple lines which are vertically aligned at once press Alt and select the aligned block … Continue reading How to select and edit multiple lines at once in Visual Studio
Enabling view refresh after .CSHTML changes for new projects in Visual Studio
Since .NET Core 3.0 your views in MVC won’t refresh after you change your .CSHTML markup. You can enable this … Continue reading Enabling view refresh after .CSHTML changes for new projects in Visual Studio
Creating .NET 5 projects in Visual Studio WITHOUT editing the project file after creation
If you want to create a .NET 5 console or web app you’ll notice by default Visual Studio will create … Continue reading Creating .NET 5 projects in Visual Studio WITHOUT editing the project file after creation
C#9 new AND, OR, NOT pattern matching keywords
C#9 (released Nov 2020) has some pattern matching enhancements. Added in C#9 (among other pattern changes) is conjunctive patterns (AND … Continue reading C#9 new AND, OR, NOT pattern matching keywords
Using C# indices and range syntax to access elements in a sequence
Microsofts Indices and Ranges page provides examples of the indices and range syntax available in C# (introduced in C#8). This syntax … Continue reading Using C# indices and range syntax to access elements in a sequence
Using Visual Studio shortcuts to create C# properties
In Visual Studio typing out new C# properties along with their get/sets can be tedious. A shortcut is to type.. … Continue reading Using Visual Studio shortcuts to create C# properties
Setting connection status bar colour in SQL Server Management Studio
In SQL Server Management Studio we can set the colour of the status bar when we’re connecting to a particular … Continue reading Setting connection status bar colour in SQL Server Management Studio
Using split queries (AsSplitQuery) in Entity Framework Core to avoid the cartesian explosion problem
Without lazy loading in Entity Framework Core we must eagerly load related entities which means we can experience the ‘cartesian … Continue reading Using split queries (AsSplitQuery) in Entity Framework Core to avoid the cartesian explosion problem
Viewing all copied items in the Visual Studio clipboard ring
In Visual Studio when you copy some code it gets added into the clipboard ring which can store a maximum … Continue reading Viewing all copied items in the Visual Studio clipboard ring
String.FirstOrDefault() LINQ queries now supported in Entity Framework Core 5.0
Entity Framework Core 5.0 now supports the translation of String.FirstOrDefault() LINQ queries. In EF Core 3.1 the following would fail… … Continue reading String.FirstOrDefault() LINQ queries now supported in Entity Framework Core 5.0
Suppress output of OnConfiguring method in Entity Framework Core 5.0
If you’re using Entity Framework Core with the database first approach and re-scaffold you’ll see that by default EF Core … Continue reading Suppress output of OnConfiguring method in Entity Framework Core 5.0
Showing Visual Studio pinned tabs in a separate row
In Visual Studio if you have lots of tabs open you can pin the ones you’re directly working on to … Continue reading Showing Visual Studio pinned tabs in a separate row
How to configure a vertical tab layout in Visual Studio
If you have a wide monitor you may prefer to have Visual Studio tabs positioned vertically on the left or … Continue reading How to configure a vertical tab layout in Visual Studio
AsNoTracking with identity resolution now available in Entity Framework Core 5.0
AsNoTracking() has been around in Entity Framework for a while. Its ideal to use when pulling back a collection of … Continue reading AsNoTracking with identity resolution now available in Entity Framework Core 5.0
Does using the repository pattern with Entity Framework make sense?
I really enjoyed the Entity Framework Community Standup Ask Me Anything with Julie Lerman the other night (10th March 2021)… … Continue reading Does using the repository pattern with Entity Framework make sense?
Find All References for DB objects using a SQL Server Database Project
We use ‘Find All References’ a lot in Visual Studio to navigate around C#/VB code. By creating a SQL Server … Continue reading Find All References for DB objects using a SQL Server Database Project
How to select specific columns in Entity Framework Core
When writing SQL queries we should avoid SELECT * if we don’t need all columns as it can have a … Continue reading How to select specific columns in Entity Framework Core
Opening web apps in Incognito mode from Visual Studio
If you’re working on a web app in Visual Studio and want to launch it in Incognito mode to make … Continue reading Opening web apps in Incognito mode from Visual Studio
Use Registered Servers in SQL Server Management Studio (SSMS) for easy access to multiple DB servers
Switching between multiple DB servers in SQL Server Management Studio can be a pain. Registered Servers in SQL Server Management … Continue reading Use Registered Servers in SQL Server Management Studio (SSMS) for easy access to multiple DB servers
Using ToLower() or ToUpper() in C# to compare strings is not safe in all cultures
If you’re using Resharper, Roslynator or similar you’ll likely see string comparisons using ToLower() or ToUpper() flagged. Why are these … Continue reading Using ToLower() or ToUpper() in C# to compare strings is not safe in all cultures