In this post I demonstrate how to create and unit test an Azure function app that uses Entity Framework with an in memory database. I only debug the function app running on the local machine and never publish it to Azure, so no Azure subscription is required. This example uses Visual Studio 2022, .NET 6, Entity Framework 6.0.x, NUnit 3.x, localdb, and the azure functions tools with Visual Studio.
Read More...
In this post, I explain how I added search to this blog using Azure Cognitive Search Service. First, I'll go through creating the search service and index in the Azure Portal and then I walk through configuring the application, which is written in Blazor WebAssembly to execute simple searches and display search results. This example uses Visual Studio 2022, .NET 6, and Blazor WebAssembly.
Read More...
This post is a little different from others. Instead of a tutorial or highlighting a specific technology, I'm going to talk about how I migrated my blog, this website, from AngularJS to client-side web assembly Blazor with .NET 6. This website started at the end of 2017. At the time, I was doing a lot of AngularJS development and thought it would be good experience to start a project from scratch to really learn the framework. Fast forward 5 years (I can't believe it's been 5 years already!) and AngularJS is no longer officially supported and other web technologies have emerged. Additionally, Blazor now runs in the browser using web assembly and .NET 6 has been released. I thought it was time to move this website to something different and wanted to learn Blazor. What follows is the summary of my website rewrite project.
Read More...
In this post, I show you how to enable authorization to Azure Blob Storage using IAM on a storage account. At the end of this post, you will understand how to leverage Azure Active Directory App Registrations, Identity Access Management, RBAC, and the C# Azure identity and storage APIs to securely access Azure blob storage containers and data.
Read More...
In this post, I describe how to authenticate to OneDrive using any Azure AD account or personal Microsoft account and upload and download files. At the end of this post, you will have an understanding of how to leverage Azure, Microsoft Identity, the Microsoft Graph API, and OneDrive for storage in your application. This post requires a Microsoft account and OneDrive subscription. The free one will work. It also requires an Azure subscription with permissions to modify Active Directory. I have not been charged yet with this example but Azure costs may apply depending on usage.
Read More...
In this post, I configure an Azure B2C tenant and show how to authenticate a user through a single page application to connect to endpoints in a custom API application. By the end, you will have a working demo of an authenticated user interacting with authorized API endpoints through a SPA using Azure B2C. The single page application contains a breakout-inspired game that tracks users' scores using a custom API. An Azure subscription is required but, at the time of this post, creating an azure B2C tenant is free up to a certain number of active users.
Read More...
In this post, I examine a WPF application to play mp3 music. I will show how WPF can utilize the MVVM pattern to make code more testable. At the end of this post, you will have an understanding of the MVVM pattern and how to apply it to a WPF application with unit tests. The application is written in .NET core 3.1 and Visual Studio 2019.
Read More...
In this post I explain the strategy design pattern and show an example of applying it to import data from different data sources. The strategy pattern is a behavioral design pattern that allows different implementations to be used interchangably at runtime. An application can select the appropriate method to perform a task. The example application lets the user import music data from a csv file source or json file source. Depending on the file type, the import strategy is chosen.
Read More...
This post is an update to my previous post on how to create a custom user store in dotnet core 2. It contains updated code for working with dotnet core 3.x, the Visual Studio 2019 MVC project template, and updated screenshots. The end result is the same, an in-memory user store to plug into the ASP .NET Core Identity system.
Read More...
This post is an update to my previous post on how to create a custom password hasher in dotnet core 2. It contains updated code for working with dotnet core 3.x, the Visual Studio 2019 MVC project template, and updated screenshots. The end result is the same, a custom password hasher to plug into the ASP .NET Core Identity system.
Read More...
In this post, I explain the outbox pattern and implement an example in C#. The outbox pattern can be used when one business transaction needs to happen as a result of another business transaction but it's not possible to combine them into the same database transaction. The example contains two applications. The first allows a user to add titles and authors of books. After a new book is added, a row is created in the outbox. The second application processes the entries in the outbox. The example requires .NET Core 2.1 and SQL Server 2017 express.
Read More...
In this post, I create an Angular application that uses Dropbox for persistent storage. I start with creating a regular Angular app using the Angular CLI and then add Dropbox integration to it. At the end, you will have a working example of Dropbox integration with an Angular app.
Read More...
In this post, I detail how to turn a Raspberry Pi into a music player using RuneAudio to stream your music collection over your local network. I'll also show how to control playback from a computer, or android phone or tablet. This post uses a raspberry pi 3, RuneAudio 0.4 (build: beta-20160313) and a windows 10 PC that contains the music collection.
Read More...
Netlify is a platform for hosting frontend web applications. It also supports a bunch of server-side features like identity, lambda functions, form submissions, or custom microservices. In this post, I show an example of using the identity service in an Angular application to authenticate users. This post assumes the reader is familiar with the structure of an Angular application including routing, components, and services but you don't need to be an expert. It also requires npm and the Angular cli to run locally.
Read More...
In this post, I show how to leverage css selectors to make styles specific to an AngularJS controller or directive. The technique seems obvious once it's pointed out but it's something I never thought of until recently. Hopefully this can also help others better organize css in their AngularJS applications.
Read More...
In this post, I will show some examples for reading and writing text files using csvhelper. Csvhelper is a simple and fast library primarily used for writing csv files. Additionally, it can be configured to use any character as a delimiter. It is available via NuGet. I have used csvhelper in a number of projects for data export features or saving preferences, etc.
Read More...
In this post, I will look at how to extend the ASP .NET Core Identity membership system to use a custom user store. This will store users in memory and not a database. This would not be useful in a production application because the list of users resets every time the application is started. However, by customizing ASP .NET Core Identity, we gain a better understanding of the components and how they fit together. This tutorial requires Visual Studio 2017 and dotnet core 2.0.
Read More...
In this post, I will look at how to extend the ASP .NET Core Identity membership system to use a custom class for hashing passwords. ASP .NET Core Identity is very extendable and extending it is a good way to get a better understanding of how the system works. We can customize it by providing new implementations to its interfaces. As with any custom security implementation, customization should be done with care and be backed by good reasons. That being said, lets have some fun. This tutorial requires Visual Studio 2017, dotnet core 2.0, and LocalDb.
Read More...
In this post, I detail the steps to implement a custom external identity provider in Sitefinity. At the end, you will have a Sitefinity instance configured as a client to a separate IdentityServer application. When a user authenticates to IdentityServer the user will be authenticated to Sitefinity and assigned the 'User' role. This uses the OpenID Connect standard. I do not assume there is a pre-configured IdentityServer application already running. I will cover both the IdentityServer setup and Sitefinity setup. This post uses Sitefinity 11 and IdentityServer 4. The software required for this tutorial is Visual Studio 2017, SQL Server Express, .NET framework 4.7.1, dotnet core 2.0, and git (Optional).
Read More...
ASP .NET Core MVC comes with dependency injection built in and the options available will cover most use cases. In this post I will summarize what is available and how to configure and use it. This post does not explain the concept of dependency injection or why it is a helpful practice to follow but how it is integrated into the ASP .NET Core MVC framework.
Read More...
In this post, I walk through the steps to create a libGDX project and get it running in Android Studio 3. There are a few prompts along the way that took me several tries at different combinations before I found the one that works so I decided to document it here. This post assumes Android Studio version 3.0.1, the Android SDK, and Java are already installed.
Read More...
In this post, I detail the basic steps to install posh-git, a powershell module that integrates git into PowerShell. This makes it easier to work with git from any PowerShell session.
Read More...
In this post I will look at how to create fake data using Json Schema Faker and faker.js. Json Schema Faker is a node package that uses fake data generators and a schema defined in JSON to create fake data. Any application that handles data in the JSON format can use this for testing, prototyping, or general development. I will cover how to create a json schema and how to generate mock data for it using Json Schema Faker. This tutorial assumes basic knowledge of javacsript, NodeJS, and NPM and that NodeJS and NPM are installed.
Read More...
In the previous post I looked at how the resolve property of an AngularJS route can be used to pass dependencies to a controller. In that example the resolve property in the route configuration called a service that returned a promise. The resolve property then passes the result of the promise to the controller when it is instantiated. The question that came up is what if there is an error and the promise is rejected instead of resolved? That's what I'll be answering in this post.
Read More...
The resolve property is attached to a route in AngularJS to provide a list of dependencies for the route. The data from this list is injected into the route controller and if any of the dependencies are promises, the promise will be resolved before the controller is instantiated. This helps keep the controller clean because any data the controller depends on can be injected into it instead of the controller retrieving that data itself. This post will go through an example of using the resolve property and show the differences between using a resolve property versus putting the fetch code in the controller directly.
Read More...
The example in this post shows how the $q service can be used to harness the power of javascript promises to perform application logic in an AngularJS application. This can help keep application code organized and separate responsibilities among controllers and services.
Read More...
For this post I'm going to show 3 examples of using the C# dynamic keyword when deserializing input data instead of using data transfer objects. Many modern applications need to accept data from a variety of sources. Often times we create data transfer objects just to handle requests and responses to and from the data source. Using dynamic in C# reduces the need for data transfer objects and keeps the logic that depends on the 3rd party data source contained to one place.
Read More...