Anthony Chu Contact Me

Globally Configure Tag Helpers with ASP.NET Dependency Injection

Monday, February 8, 2016

Tag Helpers are simple to create and they help make ASP.NET MVC Razor views extremely readable. Recently I created a Tag Helper that needed to be globally configured with an API key so it can call an API.

In this article I'll discuss how to build a Tag Helper to display a GIF from Giphy; and how to use ASP.NET Core's built-in dependency injection to configure this Tag Helper at application startup.

Continue Reading...


Enabling Tag Helper Intellisense in Visual Studio

Saturday, February 6, 2016

Razor Tag Helpers is a great new feature in ASP.NET Core. While creating custom Tag Helpers, sometimes we end up with Tag Helpers that work perfectly fine at runtime, but design-time IntelliSense is missing in Visual Studio.

In this post, I'll talk about two Tag Helper IntelliSense problems in Visual Studio and how to resolve them.

Continue Reading...


Async/Await in Node.js and the Async IIFE

Monday, January 4, 2016

The async and await keywords revolutionized asynchronous programming in .NET when they were added to C# 5 in 2012. The keywords and the async/await pattern are on track to be added to ES2016.

One of the best ways to get a taste of what it'll be like in ECMAScript is to use TypeScript. TypeScript added support for async/await in version 1.7. Currently it's only supported when compiling to ES2015 (it relies on generators), so the best way to test it out is in a Node.js app (examples here run on Node 5.3.0).

Continue Reading...


Using Grunt/Gulp for Bundling and Minification in ASP.NET

Monday, November 23, 2015

ASP.NET has the Microsoft.AspNet.Web.Optimization NuGet package to bundle and minify our JavaScript and CSS at runtime. It works great and offers an excellent developer experience.

Today we'll look at how to use Grunt (or Gulp) to replace the ASP.NET Web Optimization framework for handling bundling and minification of an ASP.NET MVC 5 app. Why would we want to do this? There are a few advantage to using Grunt/Gulp for bundling:

  • Static bundles are created once at build-time rather than during runtime
  • Bundles can be uploaded to Amazon S3 or Azure Blob Storage for serving off a CDN
  • Different versions of the bundles can be served simultaneously from a CDN, supporting rollback and canary release scenarios
  • ASP.NET 5 will be moving to using Grunt/Gulp for bundling
  • Grunt and Gulp are well-known to frontend devs who'll be interacting the most with JavaScript and CSS

With first-class Grunt and Gulp support in Visual Studio 2015 via the Task Runner Explorer, using Grunt with ASP.NET is easier than ever.

Continue Reading...


ARM Template - Azure Web App with Storage and SendGrid

Thursday, November 12, 2015

Azure Resource Manager templates are extremely useful. Today we'll look at how to use a template to provision accounts for Azure Storage and SendGrid, and configure an Azure Web App to use them.

The template we'll be creating will provision these resources:

  • App Service Plan
  • Web App
  • Storage account
  • SendGrid account
  • Web App connection strings for the Storage Account
  • Web App app settings for SendGrid server and credentials

Continue Reading...