In his book, Drive: The Surprising Truth About What Motivates Us, Daniel Pink explains that “carrot and stick” motivation tactics might work when tasks are rote and require little thought, but in the modern workplace where creativity and adaptation are often needed, those same tactics backfire and decrease performance.  To motivate people to do their best work, Drive says we need […]

ASP.NET Core Caching

ASP.NET Core comes with support for three types of caching: Local in-memory caching Distributed caching with SQL Server Distributed caching with Redis In-memory caching will have the best performance, but you will need to consider maintaining cache consistency between servers in a web farm;  ASP.NET will not do this for you.  Multiple servers can share […]

Lessons Learned

In my twenty-plus years as a software developer, I have seen the profession change greatly, both in the technologies we use and the practices we employ.  Over the years, I’ve been involved with many projects, most successful, some not, and in this post I’ll discuss a few of the lessons I’ve learned that are broadly applicable to […]

ASP.NET Core Middleware

What is Middleware? Put simply, you use middleware components to compose the functionality of your ASP.NET Core application.  Anything your application does, even something as basic as serving up static files, is performed by middleware.  An application without any middleware will simply return a 404 – Not Found response for every request.  This gives you complete […]

ASP.NET 5 Logging

Logging lets your application capture run-time information that can prove invaluable when debugging problems or analyzing performance issues.  ASP.NET 5 has a default logging implementation that logs to the console, debugger, event log, or to a trace source.  If these targets don’t meet your application’s needs, you can replace the default implementation with a third-party solution, or […]

ASP.NET 5 Configuration – Settings Classes

In earlier Configuration examples, we used IConfigurationRoot to access settings with a string key, which returned a string value.  In the following example, we’ll see how to configure typed access to settings. The code snippets shown here are from the command line example project. You can find both the command line project and a Visual Studio 2015 […]

ASP.NET 5 Dependency Injection – Bring Your Own Container

The default DI container that comes with ASP.NET 5 is basic, and doesn’t support all of the features found in third-party containers. In this post we’ll see how to replace the default container with StructureMap and Autofac. Keep in mind that the ASP.NET 5 integration for these containers were only recently released and may still […]

ASP.NET 5 Dependency Injection – Lifetimes

Dependency injection is a fundamental part of ASP.NET 5, and before we continue our discussion of configuration it will be helpful to see how we work with dependency injection in ASP.NET 5. This post assumes you understand Inversion of Control (IoC) and Dependency Injection (DI). In a nutshell, these principles allow us to keep our classes […]

ASP.NET 5 Configuration – Environment Specific Settings

ASP.NET 5 lets us use an environment variable named ASPNET_ENV to specify the environment that an application is running in (the variable can also be named Hosting:Environment). You can use any value for the environment name, but “Development”, “Staging”, and “Production” are used by convention. Note: In earlier releases of ASP.NET 5, the environment variable name […]