Commit 2e5a466

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-03-22 23:31:51
trying to replace the the mass component registration.
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@96 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent af4bd10
trunk/build/lib/app/auto.fac/Autofac.dll
Binary file
trunk/build/lib/app/auto.fac/Autofac.pdb
Binary file
trunk/build/lib/app/auto.fac.contrib/AutofacContrib.DynamicProxy2.dll
Binary file
trunk/build/lib/app/auto.fac.contrib/AutofacContrib.DynamicProxy2.pdb
Binary file
trunk/product/MyMoney/boot/container/registration/auto_wire_components_in_to_the.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Reflection;
+using MoMoney.Infrastructure.Container.Windsor;
+using MoMoney.Infrastructure.Container.Windsor.configuration;
+using MoMoney.Infrastructure.Extensions;
+using MoMoney.Infrastructure.reflection;
+using MoMoney.Utility.Core;
+using MoMoney.Utility.Extensions;
+
+namespace MoMoney.boot.container.registration
+{
+    public class auto_wire_components_in_to_the : ICommand, IParameterizedCommand<IAssembly>
+    {
+        readonly IDependencyRegistration registrar;
+        readonly IComponentExclusionSpecification exclusion_policy;
+
+        public auto_wire_components_in_to_the(IDependencyRegistration registration,
+                                              IComponentExclusionSpecification exclusion_policy)
+        {
+            registrar = registration;
+            this.exclusion_policy = exclusion_policy;
+        }
+
+        public void run()
+        {
+            run(new ApplicationAssembly(Assembly.GetExecutingAssembly()));
+        }
+
+        public void run(IAssembly item)
+        {
+            item
+                .all_types()
+                .where(x => !exclusion_policy.is_satisfied_by(x))
+                .each(x => add_registration_for(x));
+        }
+
+        void add_registration_for(Type type)
+        {
+            if (type.GetInterfaces().Length > 0)
+            {
+                registrar.transient(type.first_interface(), type);
+            }
+            else
+            {
+                registrar.transient(type, type);
+            }
+            this.log().debug("registered: {0}", type);
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/boot/container/registration/auto_wire_components_in_to_the_specs.cs
@@ -0,0 +1,87 @@
+using System;
+using developwithpassion.bdd.contexts;
+using MbUnit.Framework;
+using MoMoney.Infrastructure.Container.Windsor;
+using MoMoney.Infrastructure.Container.Windsor.configuration;
+using MoMoney.Infrastructure.reflection;
+using MoMoney.Testing.spechelpers.contexts;
+using MoMoney.Testing.spechelpers.core;
+using MoMoney.Utility.Core;
+
+namespace MoMoney.boot.container.registration
+{
+    [Ignore]
+    public class behaves_like_auto_registering_components_into_container :
+        concerns_for<IParameterizedCommand<IAssembly>, auto_wire_components_in_to_the>
+    {
+        context c = () =>
+                        {
+                            exclusions_criteria = the_dependency<IComponentExclusionSpecification>();
+                            builder = the_dependency<IDependencyRegistration>();
+                        };
+
+        protected static IDependencyRegistration builder;
+        protected static IComponentExclusionSpecification exclusions_criteria;
+    }
+
+    public class when_registering_all_the_components_from_an_assembly :
+        behaves_like_auto_registering_components_into_container
+    {
+        it should_register_each_component_by_its_last_interface =
+            () => builder.was_told_to(x => x.transient(interface_type, component_with_multiple_interfaces));
+
+        it should_register_components_with_no_interface_by_their_actual_type =
+            () => builder.was_told_to(x => x.transient(component_with_no_interface, component_with_no_interface));
+
+        it should_not_register_components_that_violate_the_exclusion_policy =
+            () => builder.was_not_told_to(x => x.transient(bad_type, bad_type));
+
+        context c = () =>
+                        {
+                            assembly = an<IAssembly>();
+                            interface_type = typeof (ITestComponent);
+                            component_with_multiple_interfaces = typeof (TestComponent);
+                            component_with_no_interface = typeof (ComponentNoInterface);
+                            bad_type = typeof (BadComponent);
+
+                            when_the(assembly).is_told_to(x => x.all_types())
+                                .it_will_return(component_with_multiple_interfaces, component_with_no_interface,
+                                                bad_type);
+                            when_the(exclusions_criteria).is_told_to(x => x.is_satisfied_by(bad_type))
+                                .it_will_return(false);
+                        };
+
+        because b = () => sut.run(assembly);
+
+
+        static IAssembly assembly;
+        static Type component_with_multiple_interfaces;
+        static Type interface_type;
+        static Type component_with_no_interface;
+        static Type bad_type;
+    }
+
+    public interface IBaseComponent
+    {
+    }
+
+    public interface ITestComponent
+    {
+    }
+
+    public class BaseComponent : IBaseComponent
+    {
+    }
+
+    public class TestComponent : BaseComponent, ITestComponent
+    {
+    }
+
+    public class ComponentNoInterface
+    {
+    }
+
+    public class BadComponent
+    {
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/boot/container/registration/wire_up_the_data_access_components_into_the.cs
@@ -6,9 +6,9 @@ namespace MoMoney.boot.container.registration
 {
     internal class wire_up_the_data_access_components_into_the : ICommand
     {
-        readonly IContainerBuilder register;
+        readonly IDependencyRegistration register;
 
-        public wire_up_the_data_access_components_into_the(IContainerBuilder registry)
+        public wire_up_the_data_access_components_into_the(IDependencyRegistration registry)
         {
             register = registry;
         }
trunk/product/MyMoney/boot/container/registration/wire_up_the_essential_services_into_the.cs
@@ -1,4 +1,3 @@
-using MoMoney.Infrastructure.Container;
 using MoMoney.Infrastructure.Container.Windsor;
 using MoMoney.Infrastructure.Logging;
 using MoMoney.Infrastructure.Logging.Log4NetLogging;
@@ -8,19 +7,17 @@ namespace MoMoney.boot.container.registration
 {
     internal class wire_up_the_essential_services_into_the : ICommand
     {
-        readonly IContainerBuilder registry;
+        readonly IDependencyRegistration registration;
 
-        public wire_up_the_essential_services_into_the(IContainerBuilder registry)
+        public wire_up_the_essential_services_into_the(IDependencyRegistration registration)
         {
-            this.registry = registry;
+            this.registration = registration;
         }
 
         public void run()
         {
-            resolve.initialize_with(registry);
-            registry.singleton<IDependencyRegistry>(registry);
-            registry.singleton<IContainerBuilder>(registry);
-            registry.singleton<ILogFactory, Log4NetLogFactory>();
+            registration.singleton<IDependencyRegistration>(registration);
+            registration.singleton<ILogFactory, Log4NetLogFactory>();
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/boot/container/registration/wire_up_the_infrastructure_in_to_the.cs
@@ -1,5 +1,6 @@
 using MoMoney.Infrastructure.Container.Windsor;
 using MoMoney.Infrastructure.eventing;
+using MoMoney.Infrastructure.registries;
 using MoMoney.Infrastructure.Threading;
 using MoMoney.Infrastructure.transactions;
 using MoMoney.Presentation.Model.Projects;
@@ -9,9 +10,9 @@ namespace MoMoney.boot.container.registration
 {
     internal class wire_up_the_infrastructure_in_to_the : ICommand
     {
-        readonly IContainerBuilder registry;
+        readonly IDependencyRegistration registry;
 
-        public wire_up_the_infrastructure_in_to_the(IContainerBuilder registry)
+        public wire_up_the_infrastructure_in_to_the(IDependencyRegistration registry)
         {
             this.registry = registry;
         }
@@ -22,6 +23,7 @@ namespace MoMoney.boot.container.registration
             registry.singleton<ITimer, IntervalTimer>();
             registry.singleton<IUnitOfWorkRegistry, UnitOfWorkRegistry>();
             registry.singleton<IProject, CurrentProject>();
+            registry.transient(typeof (IRegistry<>), typeof (DefaultRegistry<>));
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/boot/container/registration/wire_up_the_mappers_in_to_the.cs
@@ -1,13 +1,13 @@
 using MoMoney.Infrastructure.Container.Windsor;
 using MoMoney.Utility.Core;
 
-namespace MoMoney.boot.container
+namespace MoMoney.boot.container.registration
 {
     internal class wire_up_the_mappers_in_to_the : ICommand
     {
-        private readonly IContainerBuilder registry;
+        private readonly IDependencyRegistration registry;
 
-        public wire_up_the_mappers_in_to_the(IContainerBuilder registry)
+        public wire_up_the_mappers_in_to_the(IDependencyRegistration registry)
         {
             this.registry = registry;
         }
trunk/product/MyMoney/boot/container/registration/wire_up_the_presentation_modules.cs
@@ -10,9 +10,9 @@ namespace MoMoney.boot.container.registration
 {
     internal class wire_up_the_presentation_modules : ICommand
     {
-        readonly IContainerBuilder registry;
+        readonly IDependencyRegistration registry;
 
-        public wire_up_the_presentation_modules(IContainerBuilder registry)
+        public wire_up_the_presentation_modules(IDependencyRegistration registry)
         {
             this.registry = registry;
         }
trunk/product/MyMoney/boot/container/registration/wire_up_the_reports_in_to_the.cs
@@ -7,9 +7,9 @@ namespace MoMoney.boot.container.registration
 {
     internal class wire_up_the_reports_in_to_the : ICommand
     {
-        private readonly IContainerBuilder registry;
+        private readonly IDependencyRegistration registry;
 
-        public wire_up_the_reports_in_to_the(IContainerBuilder registry)
+        public wire_up_the_reports_in_to_the(IDependencyRegistration registry)
         {
             this.registry = registry;
         }
trunk/product/MyMoney/boot/container/registration/wire_up_the_services_in_to_the.cs
@@ -0,0 +1,32 @@
+using MoMoney.Infrastructure.Container.Windsor;
+using MoMoney.Infrastructure.proxies;
+using MoMoney.Presentation.Context;
+using MoMoney.Tasks.application;
+using MoMoney.Utility.Core;
+
+namespace MoMoney.boot.container.registration
+{
+    internal class wire_up_the_services_in_to_the : ICommand
+    {
+        readonly IDependencyRegistration registry;
+
+        public wire_up_the_services_in_to_the(IDependencyRegistration registry)
+        {
+            this.registry = registry;
+        }
+
+        public void run()
+        {
+            registry.singleton<the_application_context, the_application_context>();
+            //registry.proxy<IBillingTasks>(new ServiceLayerConfiguration<IBillingTasks>(), () => { return null; });
+        }
+    }
+
+    internal class ServiceLayerConfiguration<T> : IConfiguration<IProxyBuilder<IBillingTasks>>
+    {
+        public void configure(IProxyBuilder<IBillingTasks> item)
+        {
+            //item.add_interceptor<UnitOfWorkInterceptor>()
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/boot/container/registration/wire_up_the_views_in_to_the.cs
@@ -18,9 +18,9 @@ namespace MoMoney.boot.container.registration
 {
     internal class wire_up_the_views_in_to_the : ICommand
     {
-        readonly IContainerBuilder register;
+        readonly IDependencyRegistration register;
 
-        public wire_up_the_views_in_to_the(IContainerBuilder registry)
+        public wire_up_the_views_in_to_the(IDependencyRegistration registry)
         {
             register = registry;
         }
trunk/product/MyMoney/boot/container/wire_up_the_container.cs
@@ -1,8 +1,6 @@
-using System;
-using System.Linq;
-using System.Reflection;
 using MoMoney.boot.container.registration;
-using MoMoney.Infrastructure.Container.Windsor;
+using MoMoney.Infrastructure.Container;
+using MoMoney.Infrastructure.Container.Autofac;
 using MoMoney.Infrastructure.Container.Windsor.configuration;
 using MoMoney.Utility.Core;
 using MoMoney.Utility.Extensions;
@@ -13,9 +11,9 @@ namespace MoMoney.boot.container
     {
         public void run()
         {
-            var container = new WindsorContainerFactory().create();
-            var registry = new WindsorDependencyRegistry(container);
-            //var registry = new AutofacDependencyRegistry();
+            //var container = new WindsorContainerFactory().create();
+            //var registry = new WindsorDependencyRegistry(container);
+            var registry = new AutofacDependencyRegistryBuilder();
             var specification = new ComponentExclusionSpecification();
             var configuration = new ComponentRegistrationConfiguration();
 
@@ -23,53 +21,17 @@ namespace MoMoney.boot.container
                 .then(new wire_up_the_data_access_components_into_the(registry))
                 .then(new wire_up_the_infrastructure_in_to_the(registry))
                 .then(new wire_up_the_mappers_in_to_the(registry))
+                .then(new wire_up_the_services_in_to_the(registry))
+                //.then(new wire_up_the_presentation_modules(registry))
                 .then(new wire_up_the_views_in_to_the(registry))
-                .then(new wire_up_the_presentation_modules(registry))
                 .then(new wire_up_the_reports_in_to_the(registry))
-                .then(new run_mass_component_registration_in_to_the(container, specification, configuration))
-                //.then(new auto_wire_components_in_to_the(registry, specification))
+                //.then(new run_mass_component_registration_in_to_the(container, specification, configuration))
+                .then(new auto_wire_components_in_to_the(registry, specification))
                 .run();
-        }
-    }
-
-    internal class auto_wire_components_in_to_the : ICommand
-    {
-        readonly IContainerBuilder builder;
-        readonly IComponentExclusionSpecification specification;
-
-        public auto_wire_components_in_to_the(IContainerBuilder builder,
-                                              IComponentExclusionSpecification specification)
-        {
-            this.builder = builder;
-            this.specification = specification;
-        }
-
-        public void run()
-        {
-            Assembly
-                .GetExecutingAssembly()
-                .GetTypes()
-                .Where(x => !specification.is_satisfied_by(x))
-                .each(register);
-        }
 
-        void register(Type type)
-        {
-            if (type.GetInterfaces().Length > 0)
-            {
-                //if (typeof(ILoggable).IsAssignableFrom(type))
-                {
-                    //builder.proxy(h
-                }
-                //else
-                {
-                    builder.transient(type.last_interface(), type);
-                }
-            }
-            else
-            {
-                builder.transient(type, type);
-            }
+            var dependency_registry = new AutofacDependencyRegistry(registry.build());
+            registry.singleton<IDependencyRegistry>(dependency_registry);
+            resolve.initialize_with(dependency_registry);
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Infrastructure/Container/Autofac/AutofacDependencyRegistry.cs
@@ -2,6 +2,8 @@ using System;
 using System.Collections.Generic;
 using Autofac;
 using Autofac.Builder;
+using Autofac.Modules;
+using AutofacContrib.DynamicProxy2;
 using MoMoney.Infrastructure.Container.Windsor;
 using MoMoney.Infrastructure.proxies;
 using MoMoney.Utility.Core;
@@ -9,20 +11,39 @@ using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Infrastructure.Container.Autofac
 {
-    internal class AutofacDependencyRegistry : IDependencyRegistry, IContainerBuilder
+    internal class AutofacDependencyRegistry : IDependencyRegistry
     {
-        ContainerBuilder builder;
-        Func<IContainer> container;
+        readonly IContainer container;
 
-        public AutofacDependencyRegistry() : this(new ContainerBuilder())
+        public AutofacDependencyRegistry(IContainer container)
         {
+            this.container = container;
         }
 
-        public AutofacDependencyRegistry(ContainerBuilder builder)
+        public Interface get_a<Interface>()
+        {
+            return container.Resolve<Interface>();
+        }
+
+        public IEnumerable<Interface> all_the<Interface>()
+        {
+            return container.Resolve<IEnumerable<Interface>>();
+        }
+    }
+
+    internal class AutofacDependencyRegistryBuilder : IDependencyRegistration, IBuilder<IContainer>
+    {
+        readonly ContainerBuilder builder;
+
+        public AutofacDependencyRegistryBuilder() : this(new ContainerBuilder())
+        {
+        }
+
+        public AutofacDependencyRegistryBuilder(ContainerBuilder builder)
         {
             this.builder = builder;
-            container = () => builder.Build();
-            container = container.memorize();
+            builder.RegisterModule(new ImplicitCollectionSupportModule());
+            builder.RegisterModule(new StandardInterceptionModule());
         }
 
         public void singleton<Contract, Implementation>() where Implementation : Contract
@@ -42,7 +63,14 @@ namespace MoMoney.Infrastructure.Container.Autofac
 
         public void transient(Type contract, Type implementation)
         {
-            builder.Register(implementation).As(contract).FactoryScoped();
+            if (contract.is_a_generic_type())
+            {
+                builder.RegisterGeneric(implementation).As(contract).FactoryScoped();
+            }
+            else
+            {
+                builder.Register(implementation).As(contract).FactoryScoped();
+            }
         }
 
         public void proxy<T>(IConfiguration<IProxyBuilder<T>> configuration, Func<T> target)
@@ -52,14 +80,9 @@ namespace MoMoney.Infrastructure.Container.Autofac
             builder.Register(x => proxy_builder.create_proxy_for(target)).As<T>().FactoryScoped();
         }
 
-        public Interface get_a<Interface>()
-        {
-            return container().Resolve<Interface>();
-        }
-
-        public IEnumerable<Interface> all_the<Interface>()
+        public IContainer build()
         {
-            return container().Resolve<IEnumerable<Interface>>();
+            return builder.Build();
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Infrastructure/Container/Windsor/configuration/ComponentExclusionSpecificationSpecs.cs
@@ -1,6 +1,6 @@
+using System;
+using System.Collections.Generic;
 using System.Windows.Forms;
-using bdddoc.domain;
-using developwithpassion.bdd.concerns;
 using developwithpassion.bdd.contexts;
 using MoMoney.Testing.spechelpers.contexts;
 using MoMoney.Testing.spechelpers.core;
@@ -16,7 +16,7 @@ namespace MoMoney.Infrastructure.Container.Windsor.configuration
     {
         it should_be_excluded = () => result.should_be_true();
 
-        because b = () => { result = sut.is_satisfied_by(typeof (Form)); };
+        because b = () => { result = sut.is_satisfied_by(typeof (FakeForm)); };
 
         static bool result;
     }
@@ -26,11 +26,21 @@ namespace MoMoney.Infrastructure.Container.Windsor.configuration
     {
         it should_be_excluded = () => result.should_be_true();
 
-        because b = () => { result = sut.is_satisfied_by(typeof (IDependencyRegistry)); };
+        because b = () => { result = sut.is_satisfied_by(typeof (FakeDependencyRegistry)); };
 
         static bool result;
     }
 
+    public class when_checking_if_a_status_class_should_be_excluded : behaves_like_component_exclusion_specification
+    {
+        it should_be_excluded = () => { result.should_be_true(); };
+        
+        because b = () => { result = sut.is_satisfied_by(typeof (FakeStaticClass)); };
+
+        static bool result;
+    }
+
+
     //public class when_checking_if_a_set_of_observations_should_be_excluded : behaves_like_component_exclusion_specification
     //{
     //    it should_be_excluded = () => result.should_be_true();
@@ -39,4 +49,24 @@ namespace MoMoney.Infrastructure.Container.Windsor.configuration
 
     //    static bool result;
     //}
+    public class FakeForm : Form
+    {
+    }
+
+    public class FakeDependencyRegistry : IDependencyRegistry
+    {
+        public Interface get_a<Interface>()
+        {
+            throw new NotImplementedException();
+        }
+
+        public IEnumerable<Interface> all_the<Interface>()
+        {
+            throw new NotImplementedException();
+        }
+    }
+
+    public static class FakeStaticClass
+    {
+    }
 }
\ No newline at end of file
trunk/product/MyMoney/Infrastructure/Container/Windsor/IContainerBuilder.cs โ†’ trunk/product/MyMoney/Infrastructure/Container/Windsor/IDependencyRegistration.cs
@@ -4,7 +4,7 @@ using MoMoney.Utility.Core;
 
 namespace MoMoney.Infrastructure.Container.Windsor
 {
-    public interface IContainerBuilder : IDependencyRegistry
+    public interface IDependencyRegistration// : IDependencyRegistry
     {
         void singleton<Contract, Implementation>() where Implementation : Contract;
         void singleton<Contract>(Contract instance_of_the_contract);
trunk/product/MyMoney/Infrastructure/Container/Windsor/WindsorDependencyRegistry.cs
@@ -8,7 +8,7 @@ using MoMoney.Utility.Extensions;
 
 namespace MoMoney.Infrastructure.Container.Windsor
 {
-    internal class WindsorDependencyRegistry : IContainerBuilder, IDependencyRegistry
+    internal class WindsorDependencyRegistry : IDependencyRegistration, IDependencyRegistry
     {
         readonly IWindsorContainer underlying_container;
 
trunk/product/MyMoney/Infrastructure/reflection/ApplicationAssembly.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace MoMoney.Infrastructure.reflection
+{
+    public class ApplicationAssembly : IAssembly
+    {
+        readonly Assembly assembly;
+
+        public ApplicationAssembly(Assembly assembly)
+        {
+            this.assembly = assembly;
+        }
+
+        public IEnumerable<Type> all_types()
+        {
+            return assembly.GetTypes();
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Infrastructure/reflection/IAssembly.cs
@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+
+namespace MoMoney.Infrastructure.reflection
+{
+    public interface IAssembly
+    {
+        IEnumerable<Type> all_types();
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Utility/Core/and_specification.cs โ†’ trunk/product/MyMoney/Utility/Core/AndSpecification.cs
@@ -1,11 +1,11 @@
 namespace MoMoney.Utility.Core
 {
-    public class and_specification<T> : ISpecification<T>
+    public class AndSpecification<T> : ISpecification<T>
     {
         readonly ISpecification<T> left;
         readonly ISpecification<T> right;
 
-        public and_specification(ISpecification<T> left, ISpecification<T> right)
+        public AndSpecification(ISpecification<T> left, ISpecification<T> right)
         {
             this.left = left;
             this.right = right;
trunk/product/MyMoney/Utility/Core/or_specification.cs โ†’ trunk/product/MyMoney/Utility/Core/OrSpecification.cs
@@ -1,11 +1,11 @@
 namespace MoMoney.Utility.Core
 {
-    public class or_specification<T> : ISpecification<T>
+    public class OrSpecification<T> : ISpecification<T>
     {
         readonly ISpecification<T> left;
         readonly ISpecification<T> right;
 
-        public or_specification(ISpecification<T> left, ISpecification<T> right)
+        public OrSpecification(ISpecification<T> left, ISpecification<T> right)
         {
             this.left = left;
             this.right = right;
trunk/product/MyMoney/Utility/Core/OrSpecificationSpecs.cs
@@ -0,0 +1,53 @@
+using developwithpassion.bdd.contexts;
+using MoMoney.Testing.spechelpers.contexts;
+using MoMoney.Testing.spechelpers.core;
+
+namespace MoMoney.Utility.Core
+{
+    public abstract class when_checking_if_one_of_two_conditions_are_met :
+        concerns_for<ISpecification<int>, OrSpecification<int>>
+    {
+        public override ISpecification<int> create_sut()
+        {
+            return new OrSpecification<int>(left, right);
+        }
+
+        context c = () =>
+                        {
+                            left = an<ISpecification<int>>();
+                            right = an<ISpecification<int>>();
+                        };
+
+        protected static ISpecification<int> left;
+        protected static ISpecification<int> right;
+    }
+
+    public class when_one_of_the_conditions_is_met : when_checking_if_one_of_two_conditions_are_met
+    {
+        it should_return_true = () => result.should_be_true();
+
+        context c = () => when_the(left).is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+        because b = () => { result = sut.is_satisfied_by(1); };
+
+        static bool result;
+    }
+
+    public class when_the_second_condition_is_met : when_checking_if_one_of_two_conditions_are_met
+    {
+        it should_return_true = () => result.should_be_true();
+
+        context c = () => when_the(right).is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+        because b = () => { result = sut.is_satisfied_by(1); };
+
+        static bool result;
+    }
+
+    public class when_neither_conditions_are_met : when_checking_if_one_of_two_conditions_are_met
+    {
+        it should_return_false = () => result.should_be_false();
+
+        because b = () => { result = sut.is_satisfied_by(1); };
+
+        static bool result;
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Utility/Core/PredicateSpecification.cs
@@ -0,0 +1,19 @@
+using System;
+
+namespace MoMoney.Utility.Core
+{
+    public class PredicateSpecification<T> : ISpecification<T>
+    {
+        readonly Predicate<T> criteria;
+
+        public PredicateSpecification(Predicate<T> criteria)
+        {
+            this.criteria = criteria;
+        }
+
+        public bool is_satisfied_by(T item)
+        {
+            return criteria(item);
+        }
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Utility/Core/PredicateSpecificationSpecs.cs
@@ -0,0 +1,19 @@
+using developwithpassion.bdd.contexts;
+using MoMoney.Testing.MetaData;
+using MoMoney.Testing.spechelpers.contexts;
+using MoMoney.Testing.spechelpers.core;
+
+namespace MoMoney.Utility.Core
+{
+    [Concern(typeof (PredicateSpecification<>))]
+    public class when_checking_if_a_criteria_is_met_and_it_is : concerns
+    {
+        it should_return_true = () => new PredicateSpecification<int>(x => true).is_satisfied_by(1).should_be_true();
+    }
+
+    [Concern(typeof (PredicateSpecification<>))]
+    public class when_checking_if_a_criteria_is_met_and_it_is_not : concerns
+    {
+        it should_return_true = () => new PredicateSpecification<int>(x => false).is_satisfied_by(1).should_be_false();
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Utility/Extensions/specification_extensions.cs
@@ -17,12 +17,12 @@ namespace MoMoney.Utility.Extensions
 
         public static ISpecification<T> and<T>(this ISpecification<T> left, ISpecification<T> right)
         {
-            return new and_specification<T>(left, right);
+            return new AndSpecification<T>(left, right);
         }
 
         public static ISpecification<T> or<T>(this ISpecification<T> left, ISpecification<T> right)
         {
-            return new or_specification<T>(left, right);
+            return new OrSpecification<T>(left, right);
         }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Utility/Extensions/SpecificationExtensionsSpecs.cs
@@ -0,0 +1,64 @@
+using developwithpassion.bdd.contexts;
+using MoMoney.Testing.spechelpers.contexts;
+using MoMoney.Testing.spechelpers.core;
+using MoMoney.Utility.Core;
+
+namespace MoMoney.Utility.Extensions
+{
+    public class when_evaluating_two_conditions : concerns
+    {
+        context c = () =>
+                        {
+                            left = an<ISpecification<int>>();
+                            right = an<ISpecification<int>>();
+                        };
+
+        protected static ISpecification<int> left;
+        protected static ISpecification<int> right;
+    }
+
+    public class when_checking_if_two_conditions_are_met_and_they_are : when_evaluating_two_conditions
+    {
+        it should_return_true = () => result.should_be_true();
+
+        context c = () =>
+                        {
+                            when_the(right).is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+                            when_the(left).is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+                        };
+
+        because b = () => { result = left.or(right).is_satisfied_by(1); };
+
+        static bool result;
+    }
+
+    public class when_checking_if_one_of_two_conditions_are_met_and_the_left_one_is_not : when_evaluating_two_conditions
+    {
+        it should_return_true = () => result.should_be_true();
+
+        context c = () =>
+                        {
+                            when_the(right).is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+                            when_the(left).is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
+                        };
+
+        because b = () => { result = left.or(right).is_satisfied_by(1); };
+
+        static bool result;
+    }
+
+    public class when_checking_if_one_of_two_conditions_are_met_and_the_right_one_is_not : when_evaluating_two_conditions
+    {
+        it should_return_true = () => result.should_be_true();
+
+        context c = () =>
+                        {
+                            when_the(right).is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
+                            when_the(left).is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+                        };
+
+        because b = () => { result = left.or(right).is_satisfied_by(1); };
+
+        static bool result;
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Utility/Extensions/TypeExtensions.cs
@@ -8,5 +8,16 @@ namespace MoMoney.Utility.Extensions
         {
             return type.GetInterfaces()[type.GetInterfaces().Length - 1];
         }
+
+        public static Type first_interface(this Type type)
+        {
+            return type.GetInterfaces()[0];
+        }
+
+        public static bool is_a_generic_type(this Type type)
+        {
+            //return type.IsGenericType;
+            return type.IsGenericTypeDefinition;
+        }
     }
 }
\ No newline at end of file
trunk/product/MyMoney/Utility/Extensions/TypeExtensionsSpecs.cs
@@ -1,12 +1,27 @@
 using developwithpassion.bdd.contexts;
 using MoMoney.Testing.spechelpers.contexts;
 using MoMoney.Testing.spechelpers.core;
+using MoMoney.Utility.Core;
 
 namespace MoMoney.Utility.Extensions
 {
     public class when_getting_the_last_interface_for_a_type : concerns
     {
-        it should_return_the_correct_one = () => typeof (TestType).last_interface().should_be_equal_to(typeof (ITestType));
+        it should_return_the_correct_one =
+            () => typeof (TestType).last_interface().should_be_equal_to(typeof (ITestType));
+    }
+
+    public class when_getting_the_first_interface_for_a_type : concerns
+    {
+        it should_return_the_correct_one = () => typeof (TestType).first_interface().should_be_equal_to(typeof (IBase));
+    }
+
+    public class when_checking_if_a_type_represents_a_generic_type_definition : concerns
+    {
+        it should_tell_the_truth = () => { 
+            typeof (IRegistry<>).is_a_generic_type().should_be_true();
+            typeof (IRegistry<int>).is_a_generic_type().should_be_false();
+        };
     }
 
     public interface IBase
trunk/product/MyMoney/MyMoney.csproj
@@ -43,6 +43,10 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\build\lib\app\auto.fac\Autofac.dll</HintPath>
     </Reference>
+    <Reference Include="AutofacContrib.DynamicProxy2, Version=1.3.3.24, Culture=neutral, PublicKeyToken=8e6b048fde719d37, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\build\lib\app\auto.fac.contrib\AutofacContrib.DynamicProxy2.dll</HintPath>
+    </Reference>
     <Reference Include="bdddoc, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\build\lib\test\bdd.doc\bdddoc.dll</HintPath>
@@ -160,10 +164,13 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="boot\container\registration\auto_wire_components_in_to_the.cs" />
+    <Compile Include="boot\container\registration\auto_wire_components_in_to_the_specs.cs" />
     <Compile Include="boot\container\registration\wire_up_the_infrastructure_in_to_the.cs" />
     <Compile Include="boot\container\tear_down_the_container.cs" />
     <Compile Include="boot\container\registration\wire_up_the_data_access_components_into_the.cs" />
     <Compile Include="boot\container\registration\wire_up_the_presentation_modules.cs" />
+    <Compile Include="boot\container\registration\wire_up_the_services_in_to_the.cs" />
     <Compile Include="DataAccess\db40\ConnectionFactory.cs" />
     <Compile Include="DataAccess\db40\EmptySession.cs" />
     <Compile Include="DataAccess\db40\ObjectDatabaseGateway.cs" />
@@ -213,7 +220,9 @@
     <Compile Include="Infrastructure\Container\Autofac\AutofacSpecs.cs" />
     <Compile Include="Infrastructure\Container\Windsor\configuration\ApplyLoggingInterceptor.cs" />
     <Compile Include="Infrastructure\Container\Windsor\configuration\ComponentExclusionSpecification.cs" />
-    <Compile Include="Infrastructure\Container\Windsor\configuration\ComponentExclusionSpecificationSpecs.cs" />
+    <Compile Include="Infrastructure\Container\Windsor\configuration\ComponentExclusionSpecificationSpecs.cs">
+      <SubType>Form</SubType>
+    </Compile>
     <Compile Include="Infrastructure\Container\Windsor\configuration\ConfigureComponentLifestyle.cs" />
     <Compile Include="Infrastructure\Container\Windsor\configuration\IComponentExclusionSpecification.cs" />
     <Compile Include="Infrastructure\Container\Windsor\configuration\ImplementationOfDependencyRegistry.cs" />
@@ -221,7 +230,7 @@
     <Compile Include="Infrastructure\Container\Windsor\configuration\NoInterfaces.cs" />
     <Compile Include="Infrastructure\Container\Windsor\configuration\RegisterComponentContract.cs" />
     <Compile Include="Infrastructure\Container\Windsor\configuration\SubclassesForm.cs" />
-    <Compile Include="Infrastructure\Container\Windsor\IContainerBuilder.cs" />
+    <Compile Include="Infrastructure\Container\Windsor\IDependencyRegistration.cs" />
     <Compile Include="Infrastructure\Container\Windsor\WindsorContainerFactory.cs" />
     <Compile Include="Infrastructure\debugging\Launch.cs" />
     <Compile Include="Infrastructure\eventing\EventAggregator.cs" />
@@ -254,6 +263,8 @@
     <Compile Include="Infrastructure\proxies\ProxyBuilderSpecs.cs" />
     <Compile Include="Infrastructure\proxies\ProxyFactory.cs" />
     <Compile Include="Infrastructure\proxies\ProxyFactorySpecs.cs" />
+    <Compile Include="Infrastructure\reflection\ApplicationAssembly.cs" />
+    <Compile Include="Infrastructure\reflection\IAssembly.cs" />
     <Compile Include="Infrastructure\registries\DefaultRegistry.cs" />
     <Compile Include="Infrastructure\registries\DefaultRegistrySpecs.cs" />
     <Compile Include="Domain\accounting\billing\Bill.cs" />
@@ -550,7 +561,7 @@
     <Compile Include="Utility\Core\ActionCommand.cs" />
     <Compile Include="Utility\Core\ChainedConfiguration.cs" />
     <Compile Include="Utility\Core\chained_mapper.cs" />
-    <Compile Include="Utility\Core\and_specification.cs" />
+    <Compile Include="Utility\Core\AndSpecification.cs" />
     <Compile Include="Utility\Core\DisposableCommand.cs" />
     <Compile Include="Utility\Core\EmptyCallback.cs" />
     <Compile Include="Utility\Core\empty_command.cs" />
@@ -591,12 +602,15 @@
     <Compile Include="Presentation\Databindings\text_property_binding.cs" />
     <Compile Include="Presentation\Presenters\Commands\display_the_splash_screen.cs" />
     <Compile Include="Presentation\Core\IPresentationModule.cs" />
+    <Compile Include="Utility\Core\OrSpecificationSpecs.cs" />
+    <Compile Include="Utility\Core\PredicateSpecification.cs" />
+    <Compile Include="Utility\Core\PredicateSpecificationSpecs.cs" />
     <Compile Include="Utility\Extensions\RegistryExtensions.cs" />
     <Compile Include="Presentation\Model\Menu\File\FileMenu.cs" />
     <Compile Include="Presentation\Model\Menu\Help\HelpMenu.cs" />
     <Compile Include="Utility\Core\ISpecification.cs" />
     <Compile Include="Utility\Core\Map.cs" />
-    <Compile Include="Utility\Core\or_specification.cs" />
+    <Compile Include="Utility\Core\OrSpecification.cs" />
     <Compile Include="Utility\Extensions\configuration_extensions.cs" />
     <Compile Include="Utility\Extensions\conversion_extensions.cs" />
     <Compile Include="Utility\Extensions\enumerable_extensions.cs" />
@@ -606,6 +620,7 @@
     <Compile Include="Utility\Extensions\numeric_conversions.cs" />
     <Compile Include="Utility\Extensions\numeric_conversions_specs.cs" />
     <Compile Include="Utility\Extensions\querying_extensions.cs" />
+    <Compile Include="Utility\Extensions\SpecificationExtensionsSpecs.cs" />
     <Compile Include="Utility\Extensions\specification_extensions.cs" />
     <Compile Include="Infrastructure\Logging\ILogFactory.cs" />
     <Compile Include="Infrastructure\Logging\ILogger.cs" />