csharp

The Datasync Community Toolkit - Day 4: Access control

7 minute read

This article is the fourth in a series of articles about the Datasync Community Toolkit, which is a set of open source libraries for building client-server applications where the application data is available offline. The Datasync Community Toolkit allows you to connect to any database, use any authentication, and provides robust authorization rules. You implement each side of the application (...

The Datasync Community Toolkit - Day 3: Custom repositories

10 minute read

This article is the third in a series of articles about the Datasync Community Toolkit, which is a set of open source libraries for building client-server applications where the application data is available offline. The Datasync Community Toolkit allows you to connect to any database, use any authentication, and provides robust authorization rules. You implement each side of the application (c...

The Datasync Community Toolkit - Day 2: The standard repositories

8 minute read

This article is the second in a series of articles about the Datasync Community Toolkit, which is a set of open source libraries for building client-server applications where the application data is available offline. The Datasync Community Toolkit allows you to connect to any database, use any authentication, and provides robust authorization rules. You implement each side of the application...

Introducing the Datasync Community Toolkit - Day 1: The basic service

15 minute read

This article is the first in a series of articles about the Datasync Community Toolkit, which is a set of open source libraries for building client-server applications where the application data is available offline. Unlike, for example, Firebase or AWS AppSync (which are two competitors in this space), the Datasync Community Toolkit allows you to connect to any database, use any authenticatio...

Customizing Keycloak with Aspire - Part 3

6 minute read

This is the last article in a trio of articles about incorporating Keycloak into .NET Aspire applications. Thus far, I’ve covered the basics and some common customizations. This part covers what you need to do if you want to store the identity information within a PostgreSQL database. I’ve chosen PostgreSQL for this because it seems to be the database of choice for Aspire when you want to ru...

Customizing Keycloak with Aspire - Part 2

4 minute read

In my last article, I introduced the Keycloak identity service and showed how the development version can be easily integrated into a project. Development services get you started quickly and allow you to defer the details until later on. At some point, however, you need to take control of your service and start working towards production. There are a number of things that the development ve...

Integrating Keycloak with Aspire - Part 1

8 minute read

In my series on ASP.NET Identity, I mentioned (several times) that you should be using Keycloak, Auth0, Corbado, or another identity service instead of rolling your own. That’s all good, but I left it up to you to figure out exactly how to do that. I thought it would be a good idea to configure an Aspire project from the beginning and show how authentication and authorization with a service w...

ASP.NET Identity deep dive - Part 6 (Social logins)

11 minute read

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup. Account registration. Signing in and out with a username and password. Password reset. Email confirmations. Social logins. Now that I have the basic flows sorted out (which includes username/password with re...

ASP.NET Identity deep dive - Part 5 (Sending email)

12 minute read

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup. Account registration. Signing in and out with a username and password. Password reset. Email confirmations. Social logins. Today is the final spot for the basic flows. Up to this point, I’ve been logging li...

ASP.NET Identity deep dive - Part 4 (Password reset)

7 minute read

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup. Account registration. Signing in and out with a username and password. Password reset. Email confirmations. Social logins. I’ve already implemented the registration and login/logout functionality. I’ve also ...

ASP.NET Identity deep dive - Part 3 (Authentication)

6 minute read

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup. Account registration. Signing in and out with a username and password. Password reset. Email confirmations. Social logins. Today, I’m tackling authentication - that is, signing in and out of an account using...

ASP.NET Identity deep dive - Part 2 (Registration)

13 minute read

This article is one of a number of articles I will write over the coming month and will go into depth about the ASP.NET Identity system. My outline thus far: Project setup. Account registration. Signing in and out with a username and password. Password reset. Email confirmations. Social logins. As you may remember from the last article, the first user journey I am going to impl...

ASP.NET Identity deep dive - Part 1 (Project setup)

8 minute read

You may have noticed that I included ASP.NET Identity in a project a couple of posts ago. I’m currently doing a deep dive into ASP.NET Identity with an eye towards an OIDC identity service based on OpenIddict. Identity is a complex topic and I still recommend that developers integrate another service rather than write their own: Keycloak is a good option if you have to store your own data...

.NET Aspire configuration patterns

9 minute read

If you recall my last article, I transitioned my working application to .NET Aspire. This opinionated pattern allows me to run a complete microservice application within Docker Desktop, but then seamlessly deploy to Azure Container Apps and other platform services with the same code base. I don’t need to worry about where my database is going to be - it’s done for me. This is a great product...

Local development for the cloud: Transitioning to .NET Aspire

13 minute read

I’ve been working on a new project recently. It requires that I work with microservices and containers as it will eventually be runnable on either Kubernetes or (more likely) Azure Container Apps. My latest bit is to get ASP.NET identity working with PostgreSQL. And here lies a problem. In order to properly debug the code, I need the ASP.NET bits to be running locally. But to integrate wit...

Making ASP.NET Core applications readable - the options patterns

6 minute read

Applications are read more often than they are written. The normal situation when a developer comes onto a project is that anything from a couple of weeks to several months is requried to come “up to speed” on the code base. Making the efforts required for readability of the code is important, and I spend a ton of time up front to ensure my applications are understandable without needing an in...

Centrally managing dependencies in your C# solutions

3 minute read

Today, I’d like to talk about the best way to centrally manage dependencies in your dotNET solutions. It’s common for a single solution to comprise multiple projects. The happy path for maintaining dependencies in Visual Studio involves right-clicking on the project and selecting “Manage NuGet packages…”. Once you have a set of packages, you can keep them in sync by right-clicking on the sol...

Better data validation exceptions with C#

6 minute read

There are times when I look at code I have written and think to myself “there has to be a better way.” When I start thinking like this, I start by looking at the documentation - the .NET official documentation is incredibly well written and simple to digest, and the fundamentals section is something I believe every language documentation should aspire to. Take exceptions, for example. When I...

Building Bootstrap apps from SASS with ASP.NET Core

6 minute read

I’m building a new web application with ASP.NET Core, and I’m using Visual Studio Code with the C# Dev Kit so that I can really dive deep into the benefits and problems of using VS Code as a Visual Studio replacement. A frontend project is a good one to start with since I can check out the ways that the solution is presented while still having all the goodness of the VS Code development experie...

Organizing service injection in ASP.NET Core Minimal APIs

4 minute read

For the longest time, the Controller was the only way to introduce an API into your application. With the latest versions of ASP.NET Core, Minimal APIs became available. These offered the potential to write less code and be more efficient since they didn’t carry the baggage of the controller with them. That does come with some drawbacks, however. For me, one of the main ones is that it is so...