I post .NET / C# and Visual Studio content on LinkedIn and Twitter almost daily. Please consider following me. LinkedIn … Continue reading Please follow me on Twitter and LinkedIn for more .NET content
Return ProblemDetails from ASP.NET 8 IExceptionHandler global exception handler
IExceptionHandler allows us to globally handle exceptions in our ASP .NET 8 UI and API based apps. Here’s an example … Continue reading Return ProblemDetails from ASP.NET 8 IExceptionHandler global exception handler
Setting default global configuration for .NET types in Entity Framework
By default Entity Framework converts strings to nvarchar(MAX) in SQL Server which isn’t ideal. We can configure this mapping in … Continue reading Setting default global configuration for .NET types in Entity Framework
How to make strings non-Unicode in Entity Framework Code First
By default Entity Framework will convert string properties to nvarchar(MAX) or nvarchar(123) where 123 is the length we have set … Continue reading How to make strings non-Unicode in Entity Framework Code First
Difference between const and readonly in C#
The const and readonly keywords in C# are used to declare variables that cannot be changed after they are initialized. … Continue reading Difference between const and readonly in C#
How to auto include navigations in Entity Framework
Normally if we want to include certain navigation properties we have to explicitly do it on a query by query … Continue reading How to auto include navigations in Entity Framework
Entity Framework DB First quick start using EF Core Power Tools
It’s simple enough to get started with the Entity Framework Database First approach using the command line, but it’s even … Continue reading Entity Framework DB First quick start using EF Core Power Tools
Include sensitive data in Entity Framework logging by setting EnableSensitiveDataLogging
When we turn on logging in Entity Framework, by default it won’t output sensitive information such as query parameter values … Continue reading Include sensitive data in Entity Framework logging by setting EnableSensitiveDataLogging
Entity Framework FromSqlInterpolated examples
The FromSqlInterpolated method in Entity Framework Core is used to execute a raw SQL query that contains interpolated parameters. Interpolated … Continue reading Entity Framework FromSqlInterpolated examples
GitHub examples of .NET method usages visible in Visual Studio from 17.6+
From Visual Studio 2022 17.6 we’ll be able to see real world examples of common .NET APIs on GitHub direct … Continue reading GitHub examples of .NET method usages visible in Visual Studio from 17.6+
Simple string concatenation using String.Create and other performance sensitive approaches in .NET 8
I posted my previous simple string concatenation benchmark results where I was concatenating my name with spacer on Reddit recently. … Continue reading Simple string concatenation using String.Create and other performance sensitive approaches in .NET 8
NuGet 6.7 shows which packages are vulnerable in Visual Studio
With NuGet 6.7 which is available in Visual Studio 2022 17.8 Preview 1 (August 8th 2023) we can now see … Continue reading NuGet 6.7 shows which packages are vulnerable in Visual Studio
New summary diff view to only see changes now available in Visual Studio
Visual Studio 2022 17.8 Preview 1 was released last week (8th August 2023) and a really cool new feature it … Continue reading New summary diff view to only see changes now available in Visual Studio
Do .NET developers rely too much on third party libraries from NuGet?
Do we rely too much on third party libraries from NuGet? Are we exposing our clients to risks here by … Continue reading Do .NET developers rely too much on third party libraries from NuGet?
Poll Results : Are many .NET devs moving away from Moq after #moqgate?
I took this Twitter poll recently to gauge how many devs were thinking of moving away from Moq after the … Continue reading Poll Results : Are many .NET devs moving away from Moq after #moqgate?
7 Cognitive biases influencing our software development decisions
What are Cognitive Biases? A cognitive bias is a systematic thinking error that affects our decisions and judgments. They’re our … Continue reading 7 Cognitive biases influencing our software development decisions
Do you use a mocking framework or manually create your mocks?
Dear .NET friends, how do you like to create your mocks? 🤔 …With a framework like Moq or manually? I … Continue reading Do you use a mocking framework or manually create your mocks?
How to treat all warnings as compile errors in .NET
Warnings are too easy to ignore. Consider treating all warnings as errors by setting the TreatWarningsAsErrors property to true in … Continue reading How to treat all warnings as compile errors in .NET
Share settings across multiple projects using a Directory.Build.props file
To set properties for every project in a directory in a centralized location create a Directory.Build.props file in your solution … Continue reading Share settings across multiple projects using a Directory.Build.props file
Use Target Typed New Expressions to infer type on the right in C# 9 +
In C# 9 Target Typed New Expressions were introduced. They allow us to infer type on the right, whereas var … Continue reading Use Target Typed New Expressions to infer type on the right in C# 9 +
Poll Results : What .NET mocking library do you use?
I was wondering recently which .NET mocking library is most popular. I suspected Moq but ran a poll to find … Continue reading Poll Results : What .NET mocking library do you use?
Use params keyword in C# to accept a variable number of arguments of the same type
Do you know about the PARAMS keyword in C# ? The params keyword allows us to create methods that accept … Continue reading Use params keyword in C# to accept a variable number of arguments of the same type
How to create Parameterized Tests with xUnit
I love parameterized tests. Instead of many different test methods with different inputs set in the method body we have … Continue reading How to create Parameterized Tests with xUnit
Moq, NSubstitute and FakeItEasy mocking library syntax comparison
Which .NET mocking library syntax do you prefer from the below test examples? Moq?NSubstitute?FakeItEasy? … and which library do you … Continue reading Moq, NSubstitute and FakeItEasy mocking library syntax comparison
Poll Results : Does TDD improve code quality over writing tests after code?
It’s always a divisive topic but in your experience, does Test-Driven Development (TDD) improve code quality more than writing tests … Continue reading Poll Results : Does TDD improve code quality over writing tests after code?