Custom 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 More

Is .NET Aspire NuGet for Cloud Service Dependencies?

Recently I tweeted,

Read More

Failure suuuuucks

work suggest edit

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 More

Calling internal ctors in your unit tests

csharp tdd suggest edit

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.

Read More

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 More

Why 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.

Read More

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.

Read More

C# List Pattern Examples

We recently upgraded Abbot to .NET 7 and C# 11 and I’m just loving the new language features in C#. In this post, I’ll give a couple examples of list patterns.

Read More

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 More

Calculating MRR with Stripe and C#

stripe abbot suggest edit

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 More

Pitfalls 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 More

Lessons From a Startup Pivot

Building a startup is easy. You file some paperwork and bam! You’re a startup!

Read More

Tag Helper for Display Templates

I was minding my own business when @dahlbyk (you may know him from such hits as PoshGit) dropped this comment on an already merged pull request.

Read More

Async Disposables The Easy Way

abbot csharp suggest edit

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:

Read More

IntelliSense for Hosted C# Script

abbot csharp suggest edit

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.

Read More

HTTPS with LetsEncrypt for Azure Functions

azure security suggest edit

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 More

Subscribing 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

Writing Sparkly Abbot Skills With C#

In my last post, I wrote about some of the interesting elements of C# we take advantage of to make argument parsing in Abbot with C# nice.

Read More

Argument parsing with Abbot

Most Bot skills strive for a more natural language feel to arguments passed them. For example, to remember something with Abbot you can use @abbot rem haacked's blog is https://haacked.com. And then later recall it with @abbot rem haacked's blog. Or just @abbot rem haacked because Abbot uses fuzzy matching.

Read More