Project Description
Fluent and Convention-Based Unity Configuration Library

Purpose

In most projects where IoC is used, the process of configuring the container ends up as a largely mechanical process. Good projects will have well-defined standards for how and where an interface is mapped to a default implementation for instance:

If interface is named this and located here
use implementation named this located here

Some IoC containers such as StructureMap and others have convention-based mechanisms for defining these standards. This project attempts to bring a convention-based, terse/semi-fluent configuration API to the Unity IoC container (http://unity.codeplex.com/). The ultimate goal is to eliminate the majority of the error-prone config sections that quickly grow out of control in larger projects, and turn those configuration sections into a method to override conventions for the exceptions to your rules.

Apply Default Conventions then override

The following section of example code will apply default conventions to the container, searching in the specified assembly, locating all interfaces that have an implementation class beside them where interface IFoo would have an implementation named Foo in the same assembly and namespace. It then loads the standard unity configuration named "overrides" to... well... override any of the convention-based registration.

var container = new UnityContainer();
container.UniteFluently(c => c.AddAssembly(GetType().Assembly));
container.LoadConfiguration("overrides");

Using the below app.config
<container name="overrides">
<types>
<type type="ISomeOtherThing" mapTo="SomeAlternateThing"/>
</types>
</container>

**Releases are also vailable via NuGet (http://www.nuget.org/List/Packages/FluentUnity). **

Last edited Oct 8, 2011 at 4:02 PM by jonstelly, version 8