Commits

Nick Hodges committed 208dfde

Added in the utility units to the DPR files so that they were Findable within the application

Comments (0)

Files changed (24)

DependencyInjection/Intro/1-StartingOut/StartingOut.dpr

 
 uses
   System.SysUtils,
-  uDoOrderProcessing in 'uDoOrderProcessing.pas';
+  uDoOrderProcessing in 'uDoOrderProcessing.pas',
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas';
 
 begin
   try

DependencyInjection/Intro/1-StartingOut/StartingOut.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/2-MoveToInterfaces/MovingToInterfaces.dpr

 
 uses
   System.SysUtils,
-  uDoOrderProcessing in 'uDoOrderProcessing.pas';
+  uDoOrderProcessing in 'uDoOrderProcessing.pas',
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas';
 
 begin
   try

DependencyInjection/Intro/2-MoveToInterfaces/MovingToInterfaces.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/3-ConstructorInjection/ConstructorInjection.dpr

 
 uses
   System.SysUtils,
-  uDoOrderProcessing in 'uDoOrderProcessing.pas';
+  uDoOrderProcessing in 'uDoOrderProcessing.pas',
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas';
 
 begin
   try

DependencyInjection/Intro/3-ConstructorInjection/ConstructorInjection.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/3-ConstructorInjection/uOrderProcessor.pas

 interface
 
 uses
-     uOrder, uOrderEntry, uOrderValidator;
-
+       uOrder
+     , uOrderEntry
+     , uOrderValidator
+     ;
 type
 
   IOrderProcessor = interface

DependencyInjection/Intro/4-UseMocks/UseMocks.dpr

 
 uses
   System.SysUtils,
-  uDoOrderProcessing in 'uDoOrderProcessing.pas';
+  uDoOrderProcessing in 'uDoOrderProcessing.pas',
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas';
 
 begin
   try

DependencyInjection/Intro/4-UseMocks/UseMocks.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/5-IsolateInterfaces/IsolateInterfaces.dpr

 uses
   System.SysUtils,
   uDoOrderProcessing in 'uDoOrderProcessing.pas',
-  uOrderInterfaces in 'uOrderInterfaces.pas';
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderInterfaces in 'uOrderInterfaces.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas';
 
 begin
   try

DependencyInjection/Intro/5-IsolateInterfaces/IsolateInterfaces.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
 			<DCCReference Include="uOrderInterfaces.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/5-IsolateInterfaces/uDoOrderProcessing.pas

 implementation
 
 uses
-   uOrder, uOrderValidator, uOrderEntry, uOrderProcessor;
+     uOrder
+     , uOrderInterfaces
+     , uOrderValidator
+     , uOrderEntry
+     , uOrderProcessor;
 
 procedure DoOrderProcessing;
 var
   Order: TOrder;
-  OrderProcessor: TOrderProcessor;
+  OrderProcessor: IOrderProcessor;
 begin
   Order := TOrder.Create;
-  try
+//  try
     OrderProcessor := TOrderProcessor.Create(TOrderValidator.Create, TOrderEntry.Create);
     try
       if OrderProcessor.ProcessOrder(Order) then
       begin
         WriteLn('Order successfully processed....');
       end;
-    finally
-      OrderProcessor.Free;
-    end;
+//    finally
+//      OrderProcessor.Free;
+//    end;
   finally
     Order.Free;
   end;

DependencyInjection/Intro/6-UseContainer/UseContainer.dpr

 
 uses
   System.SysUtils,
-  uDoOrderProcessing in 'uDoOrderProcessing.pas';
+  uDoOrderProcessing in 'uDoOrderProcessing.pas',
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderInterfaces in 'uOrderInterfaces.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas',
+  uServiceLocator in 'uServiceLocator.pas';
 
 begin
   try

DependencyInjection/Intro/6-UseContainer/UseContainer.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
+			<DCCReference Include="uOrderInterfaces.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
+			<DCCReference Include="uServiceLocator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/6-UseContainer/uDoOrderProcessing.pas

         uOrder
       , uServiceLocator
       , uOrderInterfaces
-      , uOrderValidator
-      , uOrderEntry
+   //   , uOrderValidator
+   //   , uOrderEntry
       , uOrderProcessor
       ;
 
   ServiceLocator.Build;
   Order := TOrder.Create;
   try
-    OrderProcessor := TOrderProcessor.Create(ServiceLocator.Resolve<IOrderValidator>, ServiceLocator.Resolve<IOrderEntry>);
+    OrderProcessor := TOrderProcessor.Create(ServiceLocator.Resolve<IOrderValidator>,
+                                             ServiceLocator.Resolve<IOrderEntry>);
     if OrderProcessor.ProcessOrder(Order) then
     begin
       WriteLn('Order successfully processed....');

DependencyInjection/Intro/6-UseContainer/uOrderEntry.pas

 end;
 
 initialization
-  ServiceLocator.RegisterComponent<TOrderEntry>.Implements<IOrderEntry>('OEProd');
+  ServiceLocator.RegisterComponent<TOrderEntry>.Implements<IOrderEntry>;
 
 end.

DependencyInjection/Intro/6-UseContainer/uOrderValidator.pas

 end;
 
 initialization
-  ServiceLocator.RegisterComponent<TOrderValidator>.Implements<IOrderValidator>('OVProd');
+  ServiceLocator.RegisterComponent<TOrderValidator>.Implements<IOrderValidator>;
 
 end.

DependencyInjection/Intro/7-CustomConstructor/CustomConstructor.dpr

 
 uses
   System.SysUtils,
-  uDoOrderProcessing in 'uDoOrderProcessing.pas';
+  uDoOrderProcessing in 'uDoOrderProcessing.pas',
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderInterfaces in 'uOrderInterfaces.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas',
+  uServiceLocator in 'uServiceLocator.pas';
 
 begin
   try

DependencyInjection/Intro/7-CustomConstructor/CustomConstructor.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
+			<DCCReference Include="uOrderInterfaces.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
+			<DCCReference Include="uServiceLocator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/7-CustomConstructor/uDoOrderProcessing.pas

         uOrder
       , uServiceLocator
       , uOrderInterfaces
-      , uOrderValidator
-      , uOrderEntry
-      , uOrderProcessor
+   //   , uOrderValidator
+   //   , uOrderEntry
+    //  , uOrderProcessor
       ;
 
 procedure DoOrderProcessing;

DependencyInjection/Intro/8-FieldInjection/FieldInjection.dpr

 
 uses
   System.SysUtils,
-  uDoOrderProcessing in 'uDoOrderProcessing.pas';
+  uDoOrderProcessing in 'uDoOrderProcessing.pas',
+  uOrderEntry in 'uOrderEntry.pas',
+  uOrderInterfaces in 'uOrderInterfaces.pas',
+  uOrderProcessor in 'uOrderProcessor.pas',
+  uOrderValidator in 'uOrderValidator.pas',
+  uServiceLocator in 'uServiceLocator.pas';
 
 begin
   try

DependencyInjection/Intro/8-FieldInjection/FieldInjection.dproj

 				<MainSource>MainSource</MainSource>
 			</DelphiCompile>
 			<DCCReference Include="uDoOrderProcessing.pas"/>
+			<DCCReference Include="uOrderEntry.pas"/>
+			<DCCReference Include="uOrderInterfaces.pas"/>
+			<DCCReference Include="uOrderProcessor.pas"/>
+			<DCCReference Include="uOrderValidator.pas"/>
+			<DCCReference Include="uServiceLocator.pas"/>
 			<BuildConfiguration Include="Release">
 				<Key>Cfg_2</Key>
 				<CfgParent>Base</CfgParent>

DependencyInjection/Intro/8-FieldInjection/uDoOrderProcessing.pas

         uOrder
       , uServiceLocator
       , uOrderInterfaces
-      , uOrderValidator
-      , uOrderEntry
-      , uOrderProcessor
+
       ;
 
 procedure DoOrderProcessing;

DependencyInjection/Intro/8-FieldInjection/uOrderProcessor.pas

 end;
 
 initialization
-  ServiceLocator.RegisterComponent<TOrderProcessor>.Implements<IOrderProcessor>.InjectField('FOrderEntry');
+  ServiceLocator.RegisterComponent<TOrderProcessor>.Implements<IOrderProcessor>.AsSingleton.InjectField('FOrderEntry');
 end.