DevTrends Blog

The DevTrends technical blog covers .NET, Microsoft Azure, IoC, ASP.NET MVC, Web API, AspNet Core, Open Source releases plus anything else that I find interesting :-)

Displaying page 4 of 5


ASP.NET MVC Output Caching with Windows AppFabric Cache

Enterprise level web applications are typically hosted in web farms where in-process caching is less useful than a distributed caching approach such as Windows Server AppFabric or Memcached. Thanks to the extensibility features introduced with ASP.NET 4.0, modifying an application to use a distributed cache is a very simple process. This post explains how to create an AppFabric OutputCacheProvider and how to configure ASP.NET to use the new provider. We will also discuss a big limitation with the MVC3 OutputCacheAttribute and explain how this is addressed by the MvcDonutCaching NuGet package. More »


Donut Output Caching in ASP.NET MVC 3

Donut caching is the one form of output caching that is conspicuously absent from ASP.NET MVC 3 (and MVC4 as we speak) and is greatly missed by many developers. This post describes MvcDonutCaching, a new open-source NuGet package that adds donut caching to MVC3 in a simple and performant manner. More »


How not to do dependency injection - using XML over fluent configuration

Virtually all the developers that I come across who do not like using IoC containers have been put off by verbose, error prone XML-based configuration. Many people do not even realise that a type-safe alternative is available in all the popular IoC containers. If you are struggling with XML config, fluent configuration could be the answer to your prayers. More »


How not to do dependency injection - configuring the IoC container in unit test projects

You will often hear people say that using IoC allows your code to be unit testable, and they are of course correct. If you are doing dependency injection correctly, you code will inherently be unit testable. The subtlety that needs to be understood is how DI aids unit testing. It is certainly not the use of an IOC container which should have absolutely no bearing on your unit testing code. More »


Programmatically Retrieving Items From Resource Files In .Net

If you are working on an international application, then you are almost certainly using resource files. In ASP.NET (including ASP.NET MVC) there are a number of different types of resource file including global (App_GlobalResources) and local (App_LocalResources) but most people will find the satellite assembly approach the best choice. When referencing resources from within your application, using strongly typed names is preferable in most cases but there are times where a more automated approach may be more succinct and less error prone. This article explains a simple way of querying a resource file for a subset of resources. More »


How not to do dependency injection - the static or singleton container

Dependency injection and the use of IoC containers is becoming more and more popular but many development teams do not have the knowledge or experience necessary to fully utilise the power of the IoC container. In the next few posts, we will take a look at the most common mistakes and how to address them. In this post, we are going to talk about the static or singleton container and why this 'pattern' is such a bad idea. More »

open source

Integrating The Unity.Mvc3 1.1 NuGet Package From Scratch

A new version of Unity.Mvc3 has been published that targets the recently released Unity 2.1. It is available as a NuGet Package (Unity.Mvc3) downloadable from within Visual Studio. You can also download the dll and the source code from codeplex. This article explains the changes in this release and goes on to explain how to do dependency injection in an MVC application using Unity.Mvc3. More »


Stop using AutoMapper in your Data Access Code

A few months ago, Jimmy Bogard, author of the excellent AutoMapper wrote a great article about Autoprojecting LINQ queries. Now that Jimmy has done all the hard expression tree work, this article extends his example to include caching and simple flattening capabilities and goes on to show it in use in a simple EF 4.1 Code First application. More »


Importing Namespaces into Razor Views in ASP.NET MVC 3

The way that namespaces are imported into views is quite different in ASP.NET MVC 3 depending on whether you choose to use the original ASPX view engine or the newer Razor engine. This article discuses these diferences and shows how you can make namespaces available to all views without an explicit import statement in each view. More »


Configuration Settings Are A Dependency That Should Be Injected

Dependency Injection does not just apply to obvious dependencies such as repositories and logging components. It is very important to inject ALL dependencies including the less obvious ones. In my experience, one of the most overlooked areas is configuration. Many people seem perfectly happy to extract settings from config deep within their code. This is plain wrong. If you need to reference an AppSetting in your business logic, inject it. If you need a connection string in your data access code, inject that too. More »

View Newer Posts View Older Posts