DevTrends Blog
Welcome to the DevTrends technical blog. The latest articles are displayed below:
Apr27
Azure Web Sites Git Deploy For Multiple Project Solutions
Created on April 27, 2013 at 02:00 by Paul Hiles | Permalink | 1 comment
If you are trying to Git deploy a solution with multiple web projects to multiple Windows Azure websites, you will find that it does not work out of the box. This post describes a simple way to workaround this omission by creating a custom deployment script. Don't worry though - it is dead simple.
Feb29
Introducing the Unity.WebAPI NuGet Package
Created on February 29, 2012 at 23:35 by Paul Hiles | Permalink | 6 comments
Whilst the IDependencyResolver interface in the new ASP.NET Web API is identical to its in ASP.NET MVC 3+ compatriot, it is nevertheless in a different namespace and assembly and thus, effectively a different interface. Unity.WebAPI brings the functionality of the popular Unity.Mvc3 package to WebAPI, allowing you to inject dependencies into your ApiControllers via Unity and have IDisposable components automatically disposed of at the end of the request.
Jan18
Introducing Unity.WCF - providing easy IoC integration for your WCF services
Created on January 18, 2012 at 15:40 by Paul Hiles | Permalink | 32 comments
There are numerous blog posts available that explain how to hook up Unity with WCF. Unfortunately, many of these are incomplete, too basic or just plain wrong. Additionally, as far as I can tell, nobody has created a NuGet package to get you up and running as quickly as possible. This post introduces Unity.WCF, an open source NuGet package that (hopefully) just works in most situations, deals with cleaning up IDisposable instances and also provides a nice mechanism for automatically adding WCF behaviors to your services.
Jan17
Using Unity's automatic factories to lazy load expensive dependencies
Created on January 17, 2012 at 13:30 by Paul Hiles | Permalink | 2 comments
Automatic factory support in Microsoft's Unity IoC container is not something new, having been introduced with Unity 2.0 back in 2010. Unfortunately, not many people seem to know about it and the blog post that I used to find out about it is no longer available. This short post explains how to use automatic factories and why they can be useful.
Jan04
What's New In MvcDonutCaching 1.1?
Created on January 04, 2012 at 11:24 by Paul Hiles | Permalink | 13 comments
A new version of MvcDonutCaching has just been released with even more features plus several bug fixes. Following user feedback, this release centres on allowing MvcDonutCaching to be used in place of the built-in OutputCache attribute in many common scenarios. This should mean that you can take advantage of the many MvcDonutCaching benefits without losing core OutputCache functionality. V1.1 adds support for non-view action results and cache location specification and also fixes several known bugs.
Dec27
Validating WCF service operations using System.ComponentModel.DataAnnotations
Created on December 27, 2011 at 16:01 by Paul Hiles | Permalink | 13 comments
All WCF services operations need some level of parameter validation to ensure that the data passed to the operation is present and correct. Two popular methods are manual checking and the Validation Application Block (VAB) from Enterprise Library. This article discusses another option - using the validation features from System.ComponentModel.DataAnnotations.
Dec15
Book Review - PhoneGap Beginner's Guide
Created on December 15, 2011 at 14:22 by Paul Hiles | Permalink | 0 comments
PhoneGap is an interesting framework that allows you to leverage your existing skills in HTML, CSS and JavaScript to create native mobile applications in all of today's popular platforms. This is a review of PhoneGap Beginner's Guide written by Andrew Lunny.
Dec06
ASP.NET MVC Output Caching with Windows AppFabric Cache
Created on December 06, 2011 at 11:52 by Paul Hiles | Permalink | 1 comment
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.
Nov08
Donut Output Caching in ASP.NET MVC 3
Created on November 08, 2011 at 11:56 by Paul Hiles | Permalink | 76 comments
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.
Aug25
How not to do dependency injection - using XML over fluent configuration
Created on August 25, 2011 at 09:50 by Paul Hiles | Permalink | 4 comments
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.
Jul20
How not to do dependency injection - configuring the IoC container in unit test projects
Created on July 20, 2011 at 14:01 by Paul Hiles | Permalink | 2 comments
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.
Jul19
Programmatically Retrieving Items From Resource Files In .Net
Created on July 19, 2011 at 16:09 by Paul Hiles | Permalink | 0 comments
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.
Jul12
How not to do dependency injection - the static or singleton container
Created on July 12, 2011 at 12:15 by Paul Hiles | Permalink | 21 comments
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.
Jul07
Integrating The Unity.Mvc3 1.1 NuGet Package From Scratch
Created on July 07, 2011 at 16:14 by Paul Hiles | Permalink | 15 comments
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.
Jun06
Stop using AutoMapper in your Data Access Code
Created on June 06, 2011 at 21:06 by Paul Hiles | Permalink | 24 comments
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.
May23
Importing Namespaces into Razor Views in ASP.NET MVC 3
Created on May 23, 2011 at 16:30 by Paul Hiles | Permalink | 0 comments
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.





