Commit 0452649

mo khan <mo@mokhan.ca>
2010-07-17 22:35:28
replaced usage of IContainer with DependencyRegistry.
1 parent 7ae11d3
Changed files (5)
product
client
support
product/client/client.ui/bootstrappers/Bootstrapper.cs
@@ -63,6 +63,7 @@ namespace presentation.windows.bootstrappers
             builder.Register<AccountPresenter.AddNewAccountCommand>();
             builder.Register<CancelCommand>();
             builder.Register<AddNewAccountPresenter>();
+            builder.Register<AddNewAccountPresenter.CreateNewAccount>();
 
             // commanding
             builder.Register<AsynchronousCommandProcessor>().As<CommandProcessor>().SingletonScoped();
product/client/client.ui/presenters/WpfCommandBuilder.cs
@@ -1,19 +1,19 @@
-using Autofac;
+using Gorilla.Commons.Infrastructure.Container;
 
 namespace presentation.windows.presenters
 {
     public class WPFCommandBuilder : UICommandBuilder
     {
-        IContainer container;
+        DependencyRegistry container;
 
-        public WPFCommandBuilder(IContainer container)
+        public WPFCommandBuilder(DependencyRegistry container)
         {
             this.container = container;
         }
 
         public IObservableCommand build<T>(Presenter presenter) where T : UICommand
         {
-            var command = container.Resolve<T>();
+            var command = container.get_a<T>();
             return new SimpleCommand(() =>
             {
                 command.run(presenter);
product/client/client.ui/WpfPresenterFactory.cs
@@ -4,9 +4,16 @@ namespace presentation.windows
 {
     public class WpfPresenterFactory : PresenterFactory
     {
+        DependencyRegistry container;
+
+        public WpfPresenterFactory(DependencyRegistry container)
+        {
+            this.container = container;
+        }
+
         public T create<T>() where T : Presenter
         {
-            return Resolve.the<T>();
+            return container.get_a<T>();
         }
     }
 }
\ No newline at end of file
product/support/unit/client/presenters/WpfCommandBuilderSpecs.cs
@@ -1,4 +1,5 @@
 using Autofac;
+using Gorilla.Commons.Infrastructure.Container;
 using Machine.Specifications;
 using presentation.windows;
 using presentation.windows.presenters;
@@ -12,12 +13,12 @@ namespace unit.client.presenters
         {
             Establish context = () =>
             {
-                container = a<IContainer>();
+                container = a<DependencyRegistry>();
                 sut = new WPFCommandBuilder(container);
             };
 
             static protected WPFCommandBuilder sut;
-            static protected IContainer container;
+            static protected DependencyRegistry container;
         }
 
         public class when_building_a_command_to_bind_to_a_presenter : concern
@@ -31,7 +32,7 @@ namespace unit.client.presenters
             {
                 presenter = a<Presenter>();
                 command = a<UICommand>();
-                container.is_told_to(x => x.Resolve<UICommand>()).it_will_return(command);
+                container.is_told_to(x => x.get_a<UICommand>()).it_will_return(command);
             };
 
             Because b = () =>
product/support/unit/unit.csproj
@@ -58,6 +58,10 @@
       <Project>{81E2CF6C-4D61-442E-8086-BF1E017C7041}</Project>
       <Name>client %28client\client%29</Name>
     </ProjectReference>
+    <ProjectReference Include="..\..\commons\infrastructure\infrastructure.csproj">
+      <Project>{AA5EEED9-4531-45F7-AFCD-AD9717D2E405}</Project>
+      <Name>infrastructure</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Properties\" />