From: <jer...@us...> - 2008-08-10 17:05:13
|
Revision: 135 http://structuremap.svn.sourceforge.net/structuremap/?rev=135&view=rev Author: jeremydmiller Date: 2008-08-10 17:05:08 +0000 (Sun, 10 Aug 2008) Log Message: ----------- removing dependency of InstanceBuilderAssembly to the PluginType in prep for performance optimization Modified Paths: -------------- trunk/Source/StructureMap/Emitting/InstanceBuilderAssembly.cs trunk/Source/StructureMap/InstanceBuilderList.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap.Testing/Graph/EmittingTester.cs Modified: trunk/Source/StructureMap/Emitting/InstanceBuilderAssembly.cs =================================================================== --- trunk/Source/StructureMap/Emitting/InstanceBuilderAssembly.cs 2008-08-10 15:57:29 UTC (rev 134) +++ trunk/Source/StructureMap/Emitting/InstanceBuilderAssembly.cs 2008-08-10 17:05:08 UTC (rev 135) @@ -12,15 +12,12 @@ { private readonly List<string> _classNames = new List<string>(); private readonly DynamicAssembly _dynamicAssembly; - private readonly Type _pluginType; - public InstanceBuilderAssembly(Type pluginType, IEnumerable<Plugin> plugins) + public InstanceBuilderAssembly(IEnumerable<Plugin> plugins) { string assemblyName = "Builders" + guidString(); _dynamicAssembly = new DynamicAssembly(assemblyName); - _pluginType = pluginType; - foreach (Plugin plugin in plugins) { processPlugin(plugin); @@ -67,20 +64,13 @@ private void processPlugin(Plugin plugin) { - if (TypeRules.CanBeCast(_pluginType, plugin.PluggedType)) - { - string className = getInstanceBuilderClassName(plugin.PluggedType); - ClassBuilder builderClass = - _dynamicAssembly.AddClass(className, typeof (InstanceBuilder)); + string className = getInstanceBuilderClassName(plugin.PluggedType); + ClassBuilder builderClass = + _dynamicAssembly.AddClass(className, typeof (InstanceBuilder)); - configureClassBuilder(builderClass, plugin); + configureClassBuilder(builderClass, plugin); - _classNames.Add(className); - } - else - { - throw new StructureMapException(104, plugin.PluggedType.FullName, _pluginType.FullName); - } + _classNames.Add(className); } public List<InstanceBuilder> Compile() Modified: trunk/Source/StructureMap/InstanceBuilderList.cs =================================================================== --- trunk/Source/StructureMap/InstanceBuilderList.cs 2008-08-10 15:57:29 UTC (rev 134) +++ trunk/Source/StructureMap/InstanceBuilderList.cs 2008-08-10 17:05:08 UTC (rev 135) @@ -99,7 +99,7 @@ } } - InstanceBuilderAssembly builderAssembly = new InstanceBuilderAssembly(_pluginType, list); + InstanceBuilderAssembly builderAssembly = new InstanceBuilderAssembly(list); return builderAssembly.Compile(); } Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-08-10 15:57:29 UTC (rev 134) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-08-10 17:05:08 UTC (rev 135) @@ -406,6 +406,7 @@ <Compile Include="Emitting\Parameters\Methods.cs" /> <Compile Include="ErrorMessages.cs" /> <Compile Include="Graph\ITypeScanner.cs" /> + <Compile Include="Graph\PluginCache.cs" /> <Compile Include="IBootstrapper.cs" /> <Compile Include="Pipeline\ConfiguredInstance.Building.cs" /> <Compile Include="Pipeline\IStructuredInstance.cs" /> Modified: trunk/Source/StructureMap.Testing/Graph/EmittingTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/EmittingTester.cs 2008-08-10 15:57:29 UTC (rev 134) +++ trunk/Source/StructureMap.Testing/Graph/EmittingTester.cs 2008-08-10 17:05:08 UTC (rev 135) @@ -27,7 +27,7 @@ Plugin plugin = new Plugin(typeof (ComplexRule)); InstanceBuilderAssembly _InstanceBuilderAssembly = - new InstanceBuilderAssembly(typeof (Rule), new Plugin[] {plugin}); + new InstanceBuilderAssembly(new Plugin[] {plugin}); List<InstanceBuilder> list = _InstanceBuilderAssembly.Compile(); builder = list[0]; @@ -62,7 +62,7 @@ { Plugin plugin = new Plugin(typeof(NoArgClass)); InstanceBuilderAssembly _InstanceBuilderAssembly = - new InstanceBuilderAssembly(typeof(NoArgClass), new Plugin[] { plugin }); + new InstanceBuilderAssembly(new Plugin[] { plugin }); List<InstanceBuilder> list = _InstanceBuilderAssembly.Compile(); builder = list[0]; @@ -76,7 +76,7 @@ { Plugin plugin = new Plugin(typeof(WithOneSetter)); InstanceBuilderAssembly _InstanceBuilderAssembly = - new InstanceBuilderAssembly(typeof(WithOneSetter), new Plugin[] { plugin }); + new InstanceBuilderAssembly(new Plugin[] { plugin }); List<InstanceBuilder> list = _InstanceBuilderAssembly.Compile(); builder = list[0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |