Traditional ASP.NET API Controllers

When working with ASP.NET API’s, it’s common practice to have a controller class defined that represents the set of endpoints for a given resource. For example, if your API is working with a Contact resource, the controller will have several endpoints defined, maybe something like the following:

  • GET /contacts

This would be implemented in a class that ultimately derives from ControllerBase, and would handle each endpoint in its own public method as shown in this example code:

[ApiController]
[Route("api/[controller]")]
public class ContactController : ControllerBase
{
private readonly IAppDbContext _dbContext;

public ContactController(IAppDbContext dbContext)…

Static System Resources

When writing unit tests in C#, one question that often comes up is how to mock static resources, and which static resources make sense to mock in the first place. I tend to think of this in terms of whether or not the static resource is doing something that I can’t directly control. For instance, I wouldn’t mock string.IsNullOrEmpty. It's a pure function, meaning that it has no side effects, and given the same input, it will always return the same output. It also doesn't rely on any external data.

Dates area different story. DateTime.Now is NOT a pure function…


When developing applications with modern frameworks like Angular or React, you often hear about the Redux pattern for managing your global state. I’m not going to go into detail about it here, as it is very widely covered already, but in summary, it’s a data flow pattern that aims to make your code less error prone by way of immutable state.

When your application wants to update some global state (the users profile information, details about whether they’re logged in, etc.), your application will dispatch an action request to the store. The store will respond to this request via a…


For an application that I’m building out with .NET Core and Angular 11, I have the need to query the server at application startup to determine if the application has ever been run before. When the owner of the application uses the site for the first time, the back-end code checks to see if there’s an Administrator account in the system. If not, then it assumes that the application has never been run, and takes the user to a First Run screen. …


Yup, that’s actually a thing! I’ve never personally seen it discussed in any of the talks or presentations that I’ve seen on C# 8, but I ran into a scenario last night where it was useful to have, and managed to track it down on Microsoft’s documentation site, which I’ll link to below.

So, the scenario that sent me searching for a solution, and which led me to this little-discussed operator, was working with the new Nullable Reference Types in C# 8. More specifically, I was setting up an Entity Framework DbContext:

public class ApplicationDbContext : DbContext
{
public…

It’s been about 15 years since I last stepped foot in a Dojang (Korean for school or training studio), but there was a time that I was very active in that world. Taekwondo practitioners start at what most people know as a white belt, which is known as 8th gup, or 8th level, within the Kukkiwon (the governing body for WTF, or Olympic Style, Taekwondo around the world). …


Many libraries that deal with pathing (taking path “fragments” and appending them together to form a larger path) do not care whether you add trailing separator characters or not. If you supply them, they let the fragment be. If not, then the fragment separator is automatically added. For instance, both Node’s path library, as well as.NET’s System.IO.Path methods, allow you to provide file path fragments, and if there are missing path separators between, they will be added automatically.

Apparently, this is the the case for Uri’s in .NET. Looking through the documentation, there is no direct equivalent for concatenating Uri…


No matter what you do for a living, one of the core skills that you must nurture and constantly grow is your ability to communicate effectively. Relationships, be they professional, platonic, romantic, or otherwise are built up or torn down by how we communicate with one another. Say the right thing at the right time, and you empower a project to move forward, seal a professional relationship with a customer or vendor, or just make someone’s day a little better. Say the wrong thing, however, then the project stalls, the customer walks, or you’ve wounded someone in a way that…


I’m releasing the slides and code for a couple of talks that I put together for the developer interns that I worked with this last year. They’re being released under the MIT License, so feel free to copy them, modify them, and use them as you see fit. They provided the interns that I worked with with value, so I’m hoping that others can get value from them as well. If you have any suggestions for improvements, let me know!

The first talk, titled Interviewing Fundamentals — How to be an Interview Rockstar, discusses my beliefs on what constitutes a…


With the introduction of the WSL (Windows Subsystem for Linux), Windows users now have the ability to switch back and forth between cmd.exe, PowerShell, and Bash (or not at all, of course) at will. That said, I’ve chosen to use the Bash shell as the terminal within VSCode.

And this all works fine… until you need to commit your code to a remote git repository. I have my github account set up to use SSH tokens for authentication, and had originally set up the token, via git-bash, on the Windows side. Now, I want to use the same SSH token…

Jamie Nordmeyer

I’m a Full-stack Software Engineer and Architect living and working in the Portland, OR Metro area, specializing in .NET and web technologies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store