Using SignalR in an ASP.NET MVC Application

SignalR is a real-time communication framework from Microsoft. SignalR can be used for communications between the server and client and between clients by using the server as a go between. In this post, I will show you how to create yet another chat application (there are many already out there using SignalR) but I will look at some of the …

Creating an Entity Framework Interceptor to Log All Queries

Debugging queries generated by Entity Framework can be a huge hassle. In the past, the easiest way to was to either use an Entity Framework profiler and most of them are not free or use a profiler in the database engine to capture them. However, Entity Framework has the concept of an Interceptor that can be used to perform some …

Angular Child Routes Explained

Angular 2+ has a neat way to deal with child routes but those coming from AngularJS may find them a bit confusing. In this post, I will show how to use them with <router-outlet></router-outlet>for a seamless experience. First, lets take a look at an abbreviated version of the app-routing.ts file. const appRoutes: Routes = [ { path: ‘product/:id’, component: ProductComponent, children: …

The Case Against Self-Aware ViewModels in ASP.NET MVC

ViewModels in ASP.NET MVC are a valuable tool and are widely considered a best practice in developing MVC applications. In this post, I will make a case for why ViewModels should NOT be self-aware. ViewModels are a commonly used mechanism to deliver everything a View needs in a single object. Without them, you would have to push them to the …

Using Unity in ASP.NET MVC 5 in Less than 5 Minutes

Unity is a dependency injection framework built by the Pattern and Practices team at Microsoft. In this post, I will give you a quick overview of implementing Unity into an ASP.NET MVC project very quickly. What is Unity? Unity is a very nicely integrated library from Microsoft that has both configuration-based and code-based dependency injection options. In this post, I …