The repository pattern is a common pattern for accessing data from a database and converting the data into an entity. The repository pattern is property the one I have used the most. But just recently, I started reading more on the different design patterns and realized a few things I did not know or misunderstood about the pattern.

Domain entity vs domain model

At some point, when starting a project from scratch, I was confused about the differences between entity and domain. I saw certain projects use entity whereas others use domain when naming the namespaces. I thought domain entity and domain model are interchangeable but that is not true. …


In the past, I had been working on applications that were multi-layered / multi-tier applications. However, I had not recognized the terminologies as well as the subtle differences between multi-layered and multi-tier architectures and some of the pitfalls one may want to watch out for when implementing the pattern.

Multi-layer architecture

Below is an example of the layers in a web application :

Image for post
Image for post

For the purpose of discussion, let’s pretend we have a fictitious Educator Tools application which is designed to help principals with managing high school students.

  • The Presentation layer represents the graphical user interface for the user to interact with the application. For example, in the Educator Tools application , we may have a button which upon clicking, talks to the controller layer to retrieve a transcript of a student and displays to the user. …

Image for post
Image for post
Photo by Wiredsmart from Pexels

This post continues from previous posts which I go over using oidc-client-js to interact with azure adb2c:

In this post, I’m going to share how to handle resetting password.

You can find the sample project here.

Create the reset password user flow

At the time of writing, Azure ADB2C has a predefined, standard version of the reset password flow. However, Microsoft recommends using a new version of the reset password flow, as Microsoft no longer updates and maintains the standard versions. …


Image for post
Image for post
Image by congerdesign from Pixabay

I recently worked on migrating users’ accounts in an existing SQL database to Azure AD B2C. I found some helpful articles from Microsoft that document different migration approaches and offer example codes on using Microsoft Graph SDK to manage the users. You can find the links to these articles and sample projects in the References section.

For the most part, I did not have much trouble with the basic CRUD operations. However, I had a bit of difficulty working with custom attributes and retrieving a user by email. In this post, I’m going to share some tips and caveats I learned. …


Published October 31, 2020 in Java

Image for post
Image for post
Image by Free-Photos from Pixabay

I want to share this familiar but cryptic error I experienced when opening certain PDFs which were streamed from a Java web application.


Image for post
Image for post
Photo by Markus Spiske from Pexels

This post is a continuation of the blog post I wrote a couple months ago on how to authenticate user against Azure ADB2C from angular app using oidc-client-js. In that post, I discussed how to integrate AD B2C sign up and sign in flows to allow the user to authenticate against AD B2C. In this post, I’m going to show an example of integrating the editing profile user flow. You can find the accompanying sample project here.

I assume you have some basic understanding of angular and Rxjs and focus primarily on the aspects relating to integrating the edit user flow. …


Image for post
Image for post
Image by lauramba from Pixabay

In this post, I go over using Oracle .NET core libraries to connect to Oracle database. In particular, we’ll look at the Oracle.ManagedDataAccess.Core and the Oracle.EntityFrameworkCore.

Using Oracle.ManagedDataAccess.Core library

The library provides a high level, intuitive API to connect and work with data in an Oracle database. From the nuget page,

Oracle Data Provider for .NET (ODP.NET) Core is an ADO.NET driver that provides fast data access from Microsoft .NET Core clients to Oracle databases. ODP.NET Core consists of a single 100% managed code dynamic-link library.

Managed code refers to the immediate language codes which the common language runtime compiled into machine codes and manages its execution. The immediate language codes are the result of compiling the high level codes in C#, Visual Basic, F# and others. …


In the past, I worked on a project in which we had had to registered applications in both regular azure AD and azure ADB2C tenants just because OAuth2 Client Credentials grant type was not supported in Azure ADB2C. However, I recently learned that it is now possible to use the grant type to obtain an access token for an app in azure ADB2C.

Not so long ago, it was not possible to obtain an access token for an application registered in azure ADB2C using OAuth2 Client Credential grant type. This fact was obvious in both Microsoft’s document and the token endpoint. For instance, the token endpoint is specific to a user flow. …


In this post, I write about OpenID and OAuth2 providers, and what can you use to build or leverage them to protect your web applications.

Before discussing about OpenID Connect and OAuth2, let’s talk about one of the traditional mechanisms to authenticate the users, form based authentication and its drawbacks.

Form based authentication

In a typical web application, the backend includes a database which stores users’ accounts, and the frontend includes screens for login, registration, profile editing, password reset etc.. The login screen consists of a form for the user to enter credentials within the app. On login, the application validates the credentials against the database and gains access to the user. Everything happens within the app. …


Image for post
Image for post
Image by Natalia Ovcharenko from Pixabay

In this post, I want to share an example of using Azure Devops to automatically build and deploy a .NET console application as a windows service to run on a Windows VM.

Enable .NET core 3 app to run as a windows service

For this example, I have scaffolded a simple .NET core console application using Visual Studio. It is a very rudimentary app which logs out a message every minute until stop. You can generate a similar project using Worker Service Template as a starting point. You can checkout the codes for this project on my Github repo.

At the high level, to enable a .NET core app to run as a windows service, you need the…

About

Tai Bo

Backend developer in .NET core. I enjoy the outdoor, hanging out with good friends, reading and personal development.

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