From: <jer...@us...> - 2010-02-04 13:50:24
|
Revision: 340 http://structuremap.svn.sourceforge.net/structuremap/?rev=340&view=rev Author: jeremydmiller Date: 2010-02-04 13:50:17 +0000 (Thu, 04 Feb 2010) Log Message: ----------- pushed the AssemblyScannerExtensions to the same namespace as Registry Modified Paths: -------------- trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs trunk/Source/StructureMap.Testing/Bugs/TryGetInstanceWithOpenGenericsBugTester.cs trunk/Source/StructureMap.Testing/Graph/FirstInterfaceConventionTester.cs trunk/Source/StructureMap.Testing/Graph/GenericConnectionScannerTester.cs trunk/Source/StructureMap.Testing/Graph/SingleImplementationScannerTester.cs Added Paths: ----------- trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs Removed Paths: ------------- trunk/Source/StructureMap/AssemblyScannerExtensions.cs Deleted: trunk/Source/StructureMap/AssemblyScannerExtensions.cs =================================================================== --- trunk/Source/StructureMap/AssemblyScannerExtensions.cs 2010-02-04 13:40:53 UTC (rev 339) +++ trunk/Source/StructureMap/AssemblyScannerExtensions.cs 2010-02-04 13:50:17 UTC (rev 340) @@ -1,63 +0,0 @@ -using System; -using StructureMap.Configuration.DSL.Expressions; -using StructureMap.Graph; - -namespace StructureMap -{ - /// <summary> - /// Extend the assembly scanning DSL to support the built-in registration conventions - /// </summary> - public static class AssemblyScannerExtensions - { - /// <summary> - /// Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete - /// class named "Something" that implements "ISomething" will be automatically - /// added to PluginType "ISomething" - /// </summary> - public static ConfigureConventionExpression WithDefaultConventions(this IAssemblyScanner assemblyScanner) - { - var convention = new DefaultConventionScanner(); - assemblyScanner.With(convention); - return new ConfigureConventionExpression(convention); - } - - /// <summary> - /// Scans for PluginType's and Concrete Types that close the given open generic type - /// </summary> - /// <example> - /// - /// </example> - /// <param name="openGenericType"></param> - public static ConfigureConventionExpression ConnectImplementationsToTypesClosing(this IAssemblyScanner assemblyScanner, Type openGenericType) - { - var convention = new GenericConnectionScanner(openGenericType); - assemblyScanner.With(convention); - return new ConfigureConventionExpression(convention); - } - - /// <summary> - /// Automatically registers all concrete types without primitive arguments - /// against its first interface, if any - /// </summary> - public static ConfigureConventionExpression RegisterConcreteTypesAgainstTheFirstInterface(this IAssemblyScanner assemblyScanner) - { - var convention = new FirstInterfaceConvention(); - assemblyScanner.With(convention); - return new ConfigureConventionExpression(convention); - } - - /// <summary> - /// Directs the scanning to automatically register any type that is the single - /// implementation of an interface against that interface. - /// The filters apply - /// </summary> - public static ConfigureConventionExpression SingleImplementationsOfInterface(this IAssemblyScanner assemblyScanner) - { - var convention = new ImplementationMap(); - assemblyScanner.With(convention); - assemblyScanner.ModifyGraphAfterScan(convention.RegisterSingleImplementations); - return new ConfigureConventionExpression(convention); - } - - } -} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs (from rev 338, trunk/Source/StructureMap/AssemblyScannerExtensions.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs 2010-02-04 13:50:17 UTC (rev 340) @@ -0,0 +1,63 @@ +using System; +using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL +{ + /// <summary> + /// Extend the assembly scanning DSL to support the built-in registration conventions + /// </summary> + public static class AssemblyScannerExtensions + { + /// <summary> + /// Adds the DefaultConventionScanner to the scanning operations. I.e., a concrete + /// class named "Something" that implements "ISomething" will be automatically + /// added to PluginType "ISomething" + /// </summary> + public static ConfigureConventionExpression WithDefaultConventions(this IAssemblyScanner assemblyScanner) + { + var convention = new DefaultConventionScanner(); + assemblyScanner.With(convention); + return new ConfigureConventionExpression(convention); + } + + /// <summary> + /// Scans for PluginType's and Concrete Types that close the given open generic type + /// </summary> + /// <example> + /// + /// </example> + /// <param name="openGenericType"></param> + public static ConfigureConventionExpression ConnectImplementationsToTypesClosing(this IAssemblyScanner assemblyScanner, Type openGenericType) + { + var convention = new GenericConnectionScanner(openGenericType); + assemblyScanner.With(convention); + return new ConfigureConventionExpression(convention); + } + + /// <summary> + /// Automatically registers all concrete types without primitive arguments + /// against its first interface, if any + /// </summary> + public static ConfigureConventionExpression RegisterConcreteTypesAgainstTheFirstInterface(this IAssemblyScanner assemblyScanner) + { + var convention = new FirstInterfaceConvention(); + assemblyScanner.With(convention); + return new ConfigureConventionExpression(convention); + } + + /// <summary> + /// Directs the scanning to automatically register any type that is the single + /// implementation of an interface against that interface. + /// The filters apply + /// </summary> + public static ConfigureConventionExpression SingleImplementationsOfInterface(this IAssemblyScanner assemblyScanner) + { + var convention = new ImplementationMap(); + assemblyScanner.With(convention); + assemblyScanner.ModifyGraphAfterScan(convention.RegisterSingleImplementations); + return new ConfigureConventionExpression(convention); + } + + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2010-02-04 13:40:53 UTC (rev 339) +++ trunk/Source/StructureMap/StructureMap.csproj 2010-02-04 13:50:17 UTC (rev 340) @@ -336,7 +336,7 @@ <Compile Include="CloseGenericTypeExpression.cs" /> <Compile Include="ConfigurationExpression.cs" /> <Compile Include="Configuration\DictionaryReader.cs" /> - <Compile Include="AssemblyScannerExtensions.cs" /> + <Compile Include="Configuration\DSL\AssemblyScannerExtensions.cs" /> <Compile Include="Configuration\DSL\Expressions\InstanceExpression.cs" /> <Compile Include="Configuration\DSL\IRegistry.cs" /> <Compile Include="Configuration\DSL\SetterConvention.cs" /> Modified: trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs =================================================================== --- trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs 2010-02-04 13:40:53 UTC (rev 339) +++ trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs 2010-02-04 13:50:17 UTC (rev 340) @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Windows.Forms; +using StructureMap.Configuration.DSL; namespace StructureMap.DebuggerVisualizers.Testing { Modified: trunk/Source/StructureMap.Testing/Bugs/TryGetInstanceWithOpenGenericsBugTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Bugs/TryGetInstanceWithOpenGenericsBugTester.cs 2010-02-04 13:40:53 UTC (rev 339) +++ trunk/Source/StructureMap.Testing/Bugs/TryGetInstanceWithOpenGenericsBugTester.cs 2010-02-04 13:50:17 UTC (rev 340) @@ -1,5 +1,6 @@ using System.Diagnostics; using NUnit.Framework; +using StructureMap.Configuration.DSL; using StructureMap.TypeRules; namespace StructureMap.Testing.Bugs Modified: trunk/Source/StructureMap.Testing/Graph/FirstInterfaceConventionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/FirstInterfaceConventionTester.cs 2010-02-04 13:40:53 UTC (rev 339) +++ trunk/Source/StructureMap.Testing/Graph/FirstInterfaceConventionTester.cs 2010-02-04 13:50:17 UTC (rev 340) @@ -1,5 +1,6 @@ using System.Linq; using NUnit.Framework; +using StructureMap.Configuration.DSL; using StructureMap.Testing.Widget3; using StructureMap.TypeRules; Modified: trunk/Source/StructureMap.Testing/Graph/GenericConnectionScannerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/GenericConnectionScannerTester.cs 2010-02-04 13:40:53 UTC (rev 339) +++ trunk/Source/StructureMap.Testing/Graph/GenericConnectionScannerTester.cs 2010-02-04 13:50:17 UTC (rev 340) @@ -1,5 +1,6 @@ using System; using NUnit.Framework; +using StructureMap.Configuration.DSL; using StructureMap.Graph; namespace StructureMap.Testing.Graph Modified: trunk/Source/StructureMap.Testing/Graph/SingleImplementationScannerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/SingleImplementationScannerTester.cs 2010-02-04 13:40:53 UTC (rev 339) +++ trunk/Source/StructureMap.Testing/Graph/SingleImplementationScannerTester.cs 2010-02-04 13:50:17 UTC (rev 340) @@ -1,5 +1,6 @@ using System; using NUnit.Framework; +using StructureMap.Configuration.DSL; namespace StructureMap.Testing.Graph { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |