Commit 7539d3a
Changed files (11)
trunk
product
MyMoney
boot
container
Infrastructure
proxies
Presentation
Model
Navigation
Presenters
Commands
Utility
Core
trunk/product/MyMoney/boot/container/registration/wire_up_the_presentation_modules.cs
@@ -1,6 +1,7 @@
using System.Reflection;
using MoMoney.Infrastructure.Container.Windsor;
using MoMoney.Presentation.Core;
+using MoMoney.Presentation.Presenters.Commands;
using MoMoney.Utility.Core;
using MoMoney.Utility.Extensions;
@@ -17,6 +18,7 @@ namespace MoMoney.boot.container.registration
public void run()
{
+ registry.transient(typeof (IRunThe<>), typeof (RunThe<>));
Assembly
.GetExecutingAssembly()
.GetTypes()
trunk/product/MyMoney/boot/container/registration/wire_up_the_services_in_to_the.cs
@@ -1,4 +1,8 @@
+using System;
+using MoMoney.DataAccess.core;
+using MoMoney.Domain.repositories;
using MoMoney.Infrastructure.Container.Windsor;
+using MoMoney.Infrastructure.interceptors;
using MoMoney.Infrastructure.proxies;
using MoMoney.Presentation.Context;
using MoMoney.Tasks.application;
@@ -18,15 +22,39 @@ namespace MoMoney.boot.container.registration
public void run()
{
registry.singleton<the_application_context, the_application_context>();
- //registry.proxy<IBillingTasks>(new ServiceLayerConfiguration<IBillingTasks>(), () => { return null; });
+ registry.proxy(new ServiceLayerConfiguration<IBillingTasks>(
+ x =>
+ {
+ x.register_new_company(null);
+ x.save_a_new_bill_using(null);
+ }
+ ),
+ () =>
+ new BillingTasks(Lazy.load<IBillRepository>(), Lazy.load<ICompanyRepository>(),
+ Lazy.load<ICustomerTasks>()));
+
+ registry.proxy(
+ new ServiceLayerConfiguration<ICustomerTasks>(x => x.get_the_current_customer()),
+ () => new CustomerTasks(Lazy.load<IDatabaseGateway>()));
+
+ registry.proxy(
+ new ServiceLayerConfiguration<IIncomeTasks>(x => x.add_new(null)),
+ () => new IncomeTasks(Lazy.load<IDatabaseGateway>(), Lazy.load<ICustomerTasks>()));
}
}
- internal class ServiceLayerConfiguration<T> : IConfiguration<IProxyBuilder<IBillingTasks>>
+ internal class ServiceLayerConfiguration<T> : IConfiguration<IProxyBuilder<T>>
{
- public void configure(IProxyBuilder<IBillingTasks> item)
+ readonly Action<T> configure_it;
+
+ public ServiceLayerConfiguration(Action<T> configure_it)
+ {
+ this.configure_it = configure_it;
+ }
+
+ public void configure(IProxyBuilder<T> item)
{
- //item.add_interceptor<UnitOfWorkInterceptor>()
+ configure_it(item.add_interceptor(Lazy.load<IUnitOfWorkInterceptor>()).InterceptOn);
}
}
}
\ No newline at end of file
trunk/product/MyMoney/boot/container/wire_up_the_container.cs
@@ -20,6 +20,7 @@ namespace MoMoney.boot.container
var configuration = new ComponentRegistrationConfiguration();
new wire_up_the_essential_services_into_the(registry)
+ .then(new auto_wire_components_in_to_the(registry, specification))
.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))
@@ -28,7 +29,6 @@ namespace MoMoney.boot.container
.then(new wire_up_the_views_in_to_the(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))
.run();
Func<IContainer> func = registry.build;
trunk/product/MyMoney/Infrastructure/proxies/ProxyBuilder.cs
@@ -8,6 +8,9 @@ namespace MoMoney.Infrastructure.proxies
{
public interface IProxyBuilder<TypeToProxy>
{
+ IConstraintSelector<TypeToProxy> add_interceptor<Interceptor>(Interceptor interceptor)
+ where Interceptor : IInterceptor;
+
IConstraintSelector<TypeToProxy> add_interceptor<Interceptor>() where Interceptor : IInterceptor, new();
TypeToProxy create_proxy_for(TypeToProxy target);
TypeToProxy create_proxy_for(Func<TypeToProxy> target);
@@ -30,14 +33,19 @@ namespace MoMoney.Infrastructure.proxies
constraints = new Dictionary<IInterceptor, IInterceptorConstraint<TypeToProxy>>();
}
-
- public IConstraintSelector<TypeToProxy> add_interceptor<Interceptor>() where Interceptor : IInterceptor, new()
+ public IConstraintSelector<TypeToProxy> add_interceptor<Interceptor>(Interceptor interceptor)
+ where Interceptor : IInterceptor
{
var constraint = constraint_factory.CreateFor<TypeToProxy>();
- constraints.Add(new Interceptor(), constraint);
+ constraints.Add(interceptor, constraint);
return constraint;
}
+ public IConstraintSelector<TypeToProxy> add_interceptor<Interceptor>() where Interceptor : IInterceptor, new()
+ {
+ return add_interceptor(new Interceptor());
+ }
+
public TypeToProxy create_proxy_for(TypeToProxy target)
{
return create_proxy_for(() => target);
trunk/product/MyMoney/Presentation/Presenters/Commands/run_the_specs.cs
@@ -6,9 +6,9 @@ using MoMoney.Testing.spechelpers.core;
namespace MoMoney.Presentation.Presenters.Commands
{
- [Concern(typeof (run_the<>))]
+ [Concern(typeof (RunThe<>))]
public class when_initializing_different_regions_of_the_user_interface :
- concerns_for<IRunThe<IPresenter>, run_the<IPresenter>>
+ concerns_for<IRunThe<IPresenter>, RunThe<IPresenter>>
{
it should_initialize_the_presenter_that_controls_that_region =
() => application_controller.was_told_to(x => x.run<IPresenter>());
trunk/product/MyMoney/Presentation/Presenters/Commands/run_the.cs → trunk/product/MyMoney/Presentation/Presenters/Commands/RunThe.cs
@@ -7,11 +7,11 @@ namespace MoMoney.Presentation.Presenters.Commands
{
}
- public class run_the<Presenter> : IRunThe<Presenter> where Presenter : IPresenter
+ public class RunThe<Presenter> : IRunThe<Presenter> where Presenter : IPresenter
{
readonly IApplicationController applicationController;
- public run_the(IApplicationController applicationController)
+ public RunThe(IApplicationController applicationController)
{
this.applicationController = applicationController;
}
trunk/product/MyMoney/Utility/Core/ActionCommand.cs
@@ -4,7 +4,7 @@ namespace MoMoney.Utility.Core
{
public class ActionCommand : ICommand
{
- Action action;
+ readonly Action action;
public ActionCommand(Action action)
{
trunk/product/MyMoney/MyMoney.csproj
@@ -357,7 +357,7 @@
<Compile Include="Presentation\Presenters\billing\ViewAllBillsPresenter.cs" />
<Compile Include="Presentation\Presenters\Commands\RestartCommand.cs" />
<Compile Include="Presentation\Presenters\Commands\RunPresenterCommand.cs" />
- <Compile Include="Presentation\Presenters\Commands\run_the.cs" />
+ <Compile Include="Presentation\Presenters\Commands\RunThe.cs" />
<Compile Include="Presentation\Presenters\Commands\run_the_specs.cs" />
<Compile Include="Presentation\Presenters\excel\Cell.cs" />
<Compile Include="Presentation\Presenters\excel\excel_usage.cs" />