Commit 0a8ef11
Changed files (5)
trunk
product
MyMoney
boot
Infrastructure
Container
trunk/product/MyMoney/boot/container/registration/run_mass_component_registration_in_to_the.cs
@@ -1,4 +1,3 @@
-using System;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using MoMoney.Infrastructure.Container.Windsor;
@@ -9,11 +8,11 @@ namespace MoMoney.boot.container.registration
{
internal class run_mass_component_registration_in_to_the : ICommand
{
- readonly Func<IWindsorContainer> container;
+ readonly IWindsorContainer container;
readonly IComponentExclusionSpecification criteria_to_satisfy;
readonly IRegistrationConfiguration configuration;
- public run_mass_component_registration_in_to_the(Func<IWindsorContainer> container,
+ public run_mass_component_registration_in_to_the(IWindsorContainer container,
IComponentExclusionSpecification criteria_to_satisfy,
IRegistrationConfiguration configuration)
{
@@ -24,7 +23,7 @@ namespace MoMoney.boot.container.registration
public void run()
{
- container().Register(
+ container.Register(
AllTypes
.Pick()
.FromAssembly(GetType().Assembly)
trunk/product/MyMoney/boot/container/registration/wire_up_the_essential_services_into_the.cs
@@ -4,7 +4,7 @@ using MoMoney.Infrastructure.Logging;
using MoMoney.Infrastructure.Logging.Log4NetLogging;
using MoMoney.Utility.Core;
-namespace MoMoney.boot.container
+namespace MoMoney.boot.container.registration
{
internal class wire_up_the_essential_services_into_the : ICommand
{
trunk/product/MyMoney/boot/container/wire_up_the_container.cs
@@ -1,4 +1,3 @@
-using System;
using Castle.Windsor;
using MoMoney.boot.container.registration;
using MoMoney.Infrastructure.Container.Windsor;
@@ -13,8 +12,7 @@ namespace MoMoney.boot.container
{
public void run()
{
- Func<IWindsorContainer> container = () => new WindsorContainerFactory().create();
- container = container.memorize();
+ var container = new WindsorContainerFactory().create();
var registry = new WindsorDependencyRegistry(container);
var specification = new ComponentExclusionSpecification();
trunk/product/MyMoney/Infrastructure/Container/Windsor/IContainerBuilder.cs
@@ -4,7 +4,7 @@ using MoMoney.Utility.Core;
namespace MoMoney.Infrastructure.Container.Windsor
{
- public interface IContainerBuilder
+ public interface IContainerBuilder : 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,36 +8,36 @@ using MoMoney.Utility.Extensions;
namespace MoMoney.Infrastructure.Container.Windsor
{
- internal class WindsorDependencyRegistry : IDependencyRegistry, IContainerBuilder
+ internal class WindsorDependencyRegistry : IContainerBuilder
{
- readonly Func<IWindsorContainer> underlying_container;
+ readonly IWindsorContainer underlying_container;
- public WindsorDependencyRegistry(Func<IWindsorContainer> container)
+ public WindsorDependencyRegistry(IWindsorContainer container)
{
underlying_container = container;
}
public Interface get_a<Interface>()
{
- return underlying_container().Kernel.Resolve<Interface>();
+ return underlying_container.Kernel.Resolve<Interface>();
}
public IEnumerable<Interface> all_the<Interface>()
{
- return underlying_container().ResolveAll<Interface>();
+ return underlying_container.ResolveAll<Interface>();
}
public void singleton<Interface, Implementation>() where Implementation : Interface
{
var interface_type = typeof (Interface);
var implementation_type = typeof (Implementation);
- underlying_container().AddComponent(create_a_key_using(interface_type, implementation_type), interface_type,
- implementation_type);
+ underlying_container.AddComponent(create_a_key_using(interface_type, implementation_type), interface_type,
+ implementation_type);
}
public void singleton<Interface>(Interface instanceOfTheInterface)
{
- underlying_container().Kernel.AddComponentInstance<Interface>(instanceOfTheInterface);
+ underlying_container.Kernel.AddComponentInstance<Interface>(instanceOfTheInterface);
}
public void transient<Interface, Implementation>() where Implementation : Interface
@@ -47,7 +47,7 @@ namespace MoMoney.Infrastructure.Container.Windsor
public void transient(Type contract, Type implementation)
{
- underlying_container().AddComponentLifeStyle(
+ underlying_container.AddComponentLifeStyle(
create_a_key_using(contract, implementation),
contract, implementation, LifestyleType.Transient);
}