From: <jer...@us...> - 2010-02-05 01:17:08
|
Revision: 342 http://structuremap.svn.sourceforge.net/structuremap/?rev=342&view=rev Author: jeremydmiller Date: 2010-02-05 01:16:22 +0000 (Fri, 05 Feb 2010) Log Message: ----------- Pushed the AssemblyScannerExtensions back into real methods Modified Paths: -------------- trunk/Source/StructureMap/Graph/AssemblyScanner.cs trunk/Source/StructureMap/Graph/IAssemblyScanner.cs trunk/Source/StructureMap/StructureMap.csproj trunk/cruise.build Removed Paths: ------------- trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs Deleted: trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs 2010-02-04 23:30:20 UTC (rev 341) +++ trunk/Source/StructureMap/Configuration/DSL/AssemblyScannerExtensions.cs 2010-02-05 01:16:22 UTC (rev 342) @@ -1,63 +0,0 @@ -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/Graph/AssemblyScanner.cs =================================================================== --- trunk/Source/StructureMap/Graph/AssemblyScanner.cs 2010-02-04 23:30:20 UTC (rev 341) +++ trunk/Source/StructureMap/Graph/AssemblyScanner.cs 2010-02-05 01:16:22 UTC (rev 342) @@ -5,6 +5,7 @@ using System.Linq; using System.Reflection; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.TypeRules; using StructureMap.Util; @@ -280,5 +281,58 @@ } return callingAssembly; } + + + + /// <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 ConfigureConventionExpression WithDefaultConventions() + { + var convention = new DefaultConventionScanner(); + 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 ConfigureConventionExpression ConnectImplementationsToTypesClosing(Type openGenericType) + { + var convention = new GenericConnectionScanner(openGenericType); + With(convention); + return new ConfigureConventionExpression(convention); + } + + /// <summary> + /// Automatically registers all concrete types without primitive arguments + /// against its first interface, if any + /// </summary> + public ConfigureConventionExpression RegisterConcreteTypesAgainstTheFirstInterface() + { + var convention = new FirstInterfaceConvention(); + 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 ConfigureConventionExpression SingleImplementationsOfInterface() + { + var convention = new ImplementationMap(); + With(convention); + ModifyGraphAfterScan(convention.RegisterSingleImplementations); + return new ConfigureConventionExpression(convention); + } + } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/IAssemblyScanner.cs =================================================================== --- trunk/Source/StructureMap/Graph/IAssemblyScanner.cs 2010-02-04 23:30:20 UTC (rev 341) +++ trunk/Source/StructureMap/Graph/IAssemblyScanner.cs 2010-02-05 01:16:22 UTC (rev 342) @@ -178,5 +178,34 @@ void With(IRegistrationConvention convention); void ModifyGraphAfterScan(Action<PluginGraph> modifyGraph); + + /// <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> + ConfigureConventionExpression WithDefaultConventions(); + + /// <summary> + /// Scans for PluginType's and Concrete Types that close the given open generic type + /// </summary> + /// <example> + /// + /// </example> + /// <param name="openGenericType"></param> + ConfigureConventionExpression ConnectImplementationsToTypesClosing(Type openGenericType); + + /// <summary> + /// Automatically registers all concrete types without primitive arguments + /// against its first interface, if any + /// </summary> + ConfigureConventionExpression RegisterConcreteTypesAgainstTheFirstInterface(); + + /// <summary> + /// Directs the scanning to automatically register any type that is the single + /// implementation of an interface against that interface. + /// The filters apply + /// </summary> + ConfigureConventionExpression SingleImplementationsOfInterface(); } } \ No newline at end of file Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2010-02-04 23:30:20 UTC (rev 341) +++ trunk/Source/StructureMap/StructureMap.csproj 2010-02-05 01:16:22 UTC (rev 342) @@ -336,7 +336,6 @@ <Compile Include="CloseGenericTypeExpression.cs" /> <Compile Include="ConfigurationExpression.cs" /> <Compile Include="Configuration\DictionaryReader.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/cruise.build =================================================================== --- trunk/cruise.build 2010-02-04 23:30:20 UTC (rev 341) +++ trunk/cruise.build 2010-02-05 01:16:22 UTC (rev 342) @@ -4,7 +4,7 @@ <property name="deployment.dir" value="source\StructureMap.Testing.DeploymentTasks\"/> <property name="results.dir" value="results" /> <property name="nant.dir" value="bin\nant" /> - <property name="project.version" value="2.6.0" /> + <property name="project.version" value="2.6.1" /> <property name="project.config" value="release" /> <property name="archive.dir" value="archive"/> <target name="all" depends="compile, unit-test, post-clean"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |