Career Chutes and Ladder
The career ladder is a comforting fiction we’re sold as we embark on our careers: Start as Junior, climb to Senior, then Principal, Director, and VP. One day, you defeat the final boss and receive a key to the executive bathroom and and join the C-suite. You’ve made it!
Read MoreSupercharge your debugging with git bisect
Ever look for a recipe online only to scroll through a self-important rambling 10-page essay about a trip to Tuscany that inspired the author to create the recipe? Finally, after wearing out your mouse, trackpad, or Page Down key to scroll to the end, you get to the actual recipe. I hate those.
Read MoreCustom config sections using static virtual members in interfaces
C# 11 introduced a new feature - static virtual members in interfaces. The primary motivation for this feature is to support generic math algorithms. The mention of math might make some ignore this feature, but it turns out it can be useful in other scenarios.
Read More.NET Aspire vs Docker.
This is a follow-up to my previous post where I compared .NET Aspire to NuGet. In that post, I promised I would follow up with a comparison of using .NET Aspire to add a service dependency to a project versus using Docker. And looky here, I’m following through for once!
Read MoreIs .NET Aspire NuGet for Cloud Service Dependencies?
Failure suuuuucks
When you fail, many people will tell you how failure is a great teacher. And they’re not wrong. But you know what else is a great teacher? Success! And success is a lot less expensive than failure.
Read MoreCalling internal ctors in your unit tests
One of my pet peeves is when I’m using a .NET client library that uses internal constructors for its return type. For example, let’s take a look at the Azure.AI.OpenAI
nuget package. Now, I don’t mean to single out this package, as this is a common practice. It just happens to be the one I’m using at the moment. It’s an otherwise lovely package. I’m sure the authors are lovely people.
When Your DbContext Has The Wrong Scope
This is the final installment of the adventures of Bill Maack the Hapless Developer (any similarity to me is purely coincidental and a result of pure random chance in an infinite universe). Follow along as Bill continues to improve the reliability of his ASP.NET Core and Entity Framework Core code. If you haven’t read the previous installments, you can find them here:
Read MoreWhy Did That Database Throw That Exception?
In the previous installment of the adventures of the hapless developer, Bill Maack, Bill faced some code that tries to recover from a race condition when creating a User
if the User
entity doesn’t already exist.
How to Recover from a DbUpdateException With EF Core
There are cases where recovery from an Entity Framework Core (EF Core) DbUpdateException
is possible if you play your cards right. Play them wrong and the result is heartbreak and tears as every call to SaveChangesAsync
rethrows the same exception.
C# List Pattern Examples
So you want to speak at conferences
I just finished speaking at my favorite conference, the Caribbean Developer’s Conference. Held in a wonderful resort in Punta Cana, Dominican Republic, it brings together a local and international crowd of speakers and attendees. I’ve gushed about it before.
Read MoreCalculating MRR with Stripe and C#
Over here at A Serious Business, Inc. we’re very serious about security. One principle that’s important to us is what we call the Principle of Least Exposure (not to be confused with the similar Principle of Least Privilege).
Read MorePitfalls with eager loading of collections in EF Core
When using an ORM with a web app, lazy loading will almost certainly result in hidden N+1 queries. Eager loading is a great way to avoid this, but has its own pitfalls. In particular, for each query, you need to be careful about what you include in the query. If you include too much, you can end up with a lot of data that you don’t need. If you include too little, you can end up with confusing logic. For example, deep in your application code, it may not be clear if a navigation collection has been loaded yet or not. This can lead to unexpected behavior.
Read MoreLessons From a Startup Pivot
Building a startup is easy. You file some paperwork and bam! You’re a startup!
Read MoreTag Helper for Display Templates
Async Disposables The Easy Way
In the System.Reactive.Disposables
namespace (part of Reactive Extensions), there’s a small and useful Disposable
class. It has a Create
method that takes in an Action
and returns an IDisposable
instance. When that instance is disposed, the action is called. It’s a nice way of creating an ad-hoc IDisposable
. I use them often for creating a scope in code where something should happen at the end of the scope. Here’s an exceedingly trivial example:
IntelliSense for Hosted C# Script
This recent Abbot Blog Post covers abbot-cli
a new open source command-line tool. abbot-cli
makes it possible to work on Abbot skills in your local editor. In that post, I mentioned that when you retrieve a C# skill to edit locally, the tool writes a few aditional files on your machine.
HTTPS with LetsEncrypt for Azure Functions
UPDATE: there might be an easier way now. App Service Managed Certificates now supports apex domains. I’ll give it a try and report back.
Read MoreSubscribing to cloud events with Abbot
In my last post, I wrote about writing a sparkly skill in Abbot. That was fun! But Abbot isn’t only about fun. After all, our company name is A Serious Business, Inc. Seriously, that’s the name. So it’s about time I show you how to get to some serious business with Abbot.
Read More