From: <jer...@us...> - 2009-12-19 03:41:54
|
Revision: 280 http://structuremap.svn.sourceforge.net/structuremap/?rev=280&view=rev Author: jeremydmiller Date: 2009-12-19 03:41:43 +0000 (Sat, 19 Dec 2009) Log Message: ----------- killed off the obsolete configure() method in Registry. Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs trunk/Source/StructureMap.Testing.Widget5/WidgetRegistry.cs Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2009-12-19 03:05:37 UTC (rev 279) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2009-12-19 03:41:43 UTC (rev 280) @@ -75,19 +75,22 @@ private readonly List<Action<PluginGraph>> _actions = new List<Action<PluginGraph>>(); private readonly List<Action> _basicActions = new List<Action>(); - public Registry() + /// <summary> + /// Imports the configuration from another registry into this registry. + /// </summary> + /// <typeparam name="T"></typeparam> + public void IncludeRegistry<T>() where T : Registry, new() { - configure(); + _actions.Add(g => new T().ConfigurePluginGraph(g)); } /// <summary> - /// You can overide this method as a place to put the Registry DSL - /// declarations. This is not mandatory. + /// Imports the configuration from another registry into this registry. /// </summary> - [Obsolete("configure() is unnecessary. All declarations can be made in the constructor of a Registry or any other method")] - protected virtual void configure() + /// <param name="registry"></param> + public void IncludeRegistry(Registry registry) { - // no-op; + _actions.Add(registry.ConfigurePluginGraph); } protected void registerAction(Action action) Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2009-12-19 03:05:37 UTC (rev 279) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2009-12-19 03:41:43 UTC (rev 280) @@ -88,15 +88,17 @@ { private int _count; + public TestRegistry2() + { + _count++; + } + public int ExecutedCount { get { return _count; } } - protected override void configure() - { - _count++; - } + } public class FakeGateway : IGateway Modified: trunk/Source/StructureMap.Testing.Widget5/WidgetRegistry.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget5/WidgetRegistry.cs 2009-12-19 03:05:37 UTC (rev 279) +++ trunk/Source/StructureMap.Testing.Widget5/WidgetRegistry.cs 2009-12-19 03:41:43 UTC (rev 280) @@ -5,7 +5,7 @@ { public class RedGreenRegistry : Registry { - protected override void configure() + public RedGreenRegistry() { InstanceOf<IWidget>().Is.OfConcreteType<ColorWidget>().WithCtorArg("color").EqualTo("Red").WithName("Red"); InstanceOf<IWidget>().Is.OfConcreteType<ColorWidget>().WithCtorArg("color").EqualTo("Green").WithName( @@ -29,14 +29,13 @@ public class YellowBlueRegistry : Registry { - protected override void configure() + public YellowBlueRegistry() { InstanceOf<IWidget>().Is.OfConcreteType<ColorWidget>().WithCtorArg("color").EqualTo("Yellow").WithName( "Yellow"); InstanceOf<IWidget>().Is.OfConcreteType<ColorWidget>().WithProperty("color").EqualTo("Blue").WithName("Blue"); } - public override bool Equals(object obj) { if (this == obj) return true; @@ -68,7 +67,7 @@ public class BrownBlackRegistry : Registry { - protected override void configure() + public BrownBlackRegistry() { InstanceOf<IWidget>().Is.OfConcreteType<ColorWidget>().WithProperty("color").EqualTo("Brown").WithName( "Brown"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |