You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(5) |
Mar
(9) |
Apr
(9) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2008 |
Jan
(11) |
Feb
(6) |
Mar
|
Apr
(16) |
May
(28) |
Jun
(13) |
Jul
(3) |
Aug
(19) |
Sep
(11) |
Oct
(37) |
Nov
(1) |
Dec
(17) |
2009 |
Jan
(16) |
Feb
(6) |
Mar
|
Apr
(6) |
May
(1) |
Jun
(10) |
Jul
(4) |
Aug
(4) |
Sep
(4) |
Oct
(8) |
Nov
(3) |
Dec
(45) |
2010 |
Jan
(8) |
Feb
(21) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <jer...@us...> - 2008-04-07 14:07:55
|
Revision: 76 http://structuremap.svn.sourceforge.net/structuremap/?rev=76&view=rev Author: jeremydmiller Date: 2008-04-07 07:00:27 -0700 (Mon, 07 Apr 2008) Log Message: ----------- Moving the InstanceManager reference to InstanceFactory Modified Paths: -------------- trunk/Source/StructureMap/Graph/Plugin.cs trunk/Source/StructureMap/InstanceBuilder.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs trunk/Source/StructureMap/Pipeline/Instance.cs trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs trunk/Source/StructureMap.Testing/Container/ImplicitDefaultTest.cs trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/SingletonInterceptorTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/ThreadLocalStorageInterceptorTester.cs trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs trunk/Source/StructureMap.Testing/ObjectMother.cs trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs Modified: trunk/Source/StructureMap/Graph/Plugin.cs =================================================================== --- trunk/Source/StructureMap/Graph/Plugin.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap/Graph/Plugin.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -240,13 +240,13 @@ ConstructorInfo ctor = GetConstructor(); foreach (ParameterInfo parameter in ctor.GetParameters()) { - returnValue = returnValue && canTypeBeAutoFilled(parameter.ParameterType); + returnValue = returnValue && TypeCanBeAutoFilled(parameter.ParameterType); } foreach (SetterProperty setter in Setters) { Type propertyType = setter.Property.PropertyType; - returnValue = returnValue && canTypeBeAutoFilled(propertyType); + returnValue = returnValue && TypeCanBeAutoFilled(propertyType); } return returnValue; @@ -377,7 +377,7 @@ return returnValue; } - private bool canTypeBeAutoFilled(Type parameterType) + public static bool TypeCanBeAutoFilled(Type parameterType) { bool cannotBeFilled = false; @@ -388,6 +388,11 @@ return !cannotBeFilled; } + + public static bool TypeIsPrimitive(Type parameterType) + { + return parameterType.IsValueType || parameterType.Equals(typeof (string)); + } public override bool Equals(object obj) { Modified: trunk/Source/StructureMap/InstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap/InstanceBuilder.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap/InstanceBuilder.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -19,18 +19,8 @@ public abstract string PluggedType { get; } public abstract string ConcreteTypeKey { get; } - public InstanceManager Manager - { - get { return _manager; } - } - public abstract object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator); - public void SetInstanceManager(InstanceManager manager) - { - _manager = manager; - } - public bool IsType(Type type) { Type plugged = Type.GetType(PluggedType); Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -19,8 +19,8 @@ private readonly Dictionary<string, InstanceBuilder> _instanceBuilders; private readonly InstanceInterceptor _interceptor = new NulloInterceptor(); private readonly Type _pluginType; - private InterceptorLibrary _interceptorLibrary = InterceptorLibrary.Empty; private MementoSource _source; + private InstanceManager _manager = new InstanceManager(); #region static constructors @@ -145,8 +145,8 @@ try { InstanceBuilder builder = _instanceBuilders[memento.ConcreteKey]; - object constructedInstance = builder.BuildInstance(memento, builder.Manager); - CompoundInterceptor interceptor = _interceptorLibrary.FindInterceptor(constructedInstance.GetType()); + object constructedInstance = builder.BuildInstance(memento, _manager); + InstanceInterceptor interceptor = _manager.FindInterceptor(constructedInstance.GetType()); return interceptor.Process(constructedInstance); } catch (StructureMapException) @@ -178,11 +178,7 @@ /// <param name="instanceManager"></param> public void SetInstanceManager(InstanceManager instanceManager) { - _interceptorLibrary = instanceManager.InterceptorLibrary; - foreach (InstanceBuilder builder in _instanceBuilders.Values) - { - builder.SetInstanceManager(instanceManager); - } + _manager = instanceManager; } /// <summary> Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -70,12 +70,6 @@ } } - - public InterceptorLibrary InterceptorLibrary - { - get { return _interceptorLibrary; } - } - public virtual IInstanceFactory this[Type pluginType] { get @@ -502,5 +496,10 @@ protected delegate InstanceFactory CreateFactoryDelegate(Type type); #endregion + + public InstanceInterceptor FindInterceptor(Type type) + { + return _interceptorLibrary.FindInterceptor(type); + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace StructureMap.Pipeline { @@ -11,9 +12,28 @@ public class ConfiguredInstance : Instance { + private readonly Dictionary<string, string> _properties = new Dictionary<string, string>(); + private Dictionary<string, Instance> _children = new Dictionary<string, Instance>(); + protected override object build(Type type, IInstanceCreator creator) { throw new NotImplementedException(); } + + public string GetProperty(string propertyName) + { + if (!_properties.ContainsKey(propertyName)) + { + throw new StructureMapException(205, propertyName, Name); + } + + return _properties[propertyName]; + } + + public ConfiguredInstance SetProperty(string propertyName, string propertyValue) + { + _properties[propertyName] = propertyValue; + return this; + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/Instance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -12,6 +12,7 @@ object CreateInstance(string typeName, InstanceMemento memento); object CreateInstance(string typeName); object CreateInstance(Type type); + InstanceInterceptor FindInterceptor(Type type); } public interface IInstanceDiagnostics @@ -35,10 +36,15 @@ set { _interceptor = value; } } - public object Build(Type type, IInstanceCreator creator) + public virtual object Build(Type type, IInstanceCreator creator) { object rawValue = build(type, creator); - return _interceptor.Process(rawValue); + + // Intercept with the Instance-specific InstanceInterceptor + object interceptedValue = _interceptor.Process(rawValue); + + // Now, give the at large Interceptors a chance to intercept + return creator.FindInterceptor(interceptedValue.GetType()).Process(interceptedValue); } protected abstract object build(Type type, IInstanceCreator creator); Modified: trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -112,6 +112,8 @@ family.Plugins.Add(typeof (SomethingOne), "One"); InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); + InstanceMemento memento = factory.AddType<SomethingOne>(); Assert.AreEqual("One", memento.InstanceKey); Assert.AreEqual("One", memento.ConcreteKey); @@ -127,6 +129,7 @@ public void AddPluginForTypeWhenThePluginDoesNotAlreadyExistsDoesNothing() { InstanceFactory factory = ObjectMother.Factory<ISomething>(); + factory.SetInstanceManager(new InstanceManager()); InstanceMemento memento = factory.AddType<SomethingOne>(); Assert.IsNotNull(memento); Modified: trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -23,6 +23,8 @@ InstanceFactory cowFactory = new InstanceFactory(family, true); + cowFactory.SetInstanceManager(new InstanceManager()); + MemoryInstanceMemento memento = new MemoryInstanceMemento("Default", "Angus"); memento.SetProperty("Name", "Bessie"); Modified: trunk/Source/StructureMap.Testing/Container/ImplicitDefaultTest.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/ImplicitDefaultTest.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/ImplicitDefaultTest.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -13,6 +13,8 @@ typeof (IGateway), new string[] {"StructureMap.Testing.Widget3"}); + + DefaultGateway gateway = factory.GetInstance() as DefaultGateway; Assert.IsNotNull(gateway); } Modified: trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -160,6 +160,7 @@ InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); Assert.AreSame(factory.GetInstance("Red"), recordedService); } Modified: trunk/Source/StructureMap.Testing/Container/Interceptors/SingletonInterceptorTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/Interceptors/SingletonInterceptorTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/Interceptors/SingletonInterceptorTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -17,6 +17,7 @@ { PluginFamily family = ObjectMother.GetPluginFamily(typeof (Rule)); InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); _interceptor = new SingletonInterceptor(); _interceptor.InnerInstanceFactory = factory; Modified: trunk/Source/StructureMap.Testing/Container/Interceptors/ThreadLocalStorageInterceptorTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/Interceptors/ThreadLocalStorageInterceptorTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/Interceptors/ThreadLocalStorageInterceptorTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -16,6 +16,7 @@ { PluginFamily family = ObjectMother.GetPluginFamily(typeof (Rule)); InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); _interceptor = new ThreadLocalStorageInterceptor(); _interceptor.InnerInstanceFactory = factory; Modified: trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -196,6 +196,8 @@ // Just for fun, test with InstanceFactory too. InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); + MemoryInstanceMemento memento = new MemoryInstanceMemento("NotPluggable", string.Empty); memento.SetProperty("name", "DorothyTheDinosaur"); Modified: trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -57,6 +57,8 @@ family.Plugins.Add(plugin, true); InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); + InstanceMemento memento = _source.GetMemento("Enum"); EnumGridColumn column = (EnumGridColumn) factory.GetInstance(memento); @@ -72,6 +74,8 @@ family.Plugins.Add(plugin, true); InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); + InstanceMemento memento = _source.GetMemento("Long"); long count = long.Parse(memento.GetProperty("Count")); @@ -89,6 +93,8 @@ family.Plugins.Add(plugin, true); InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); + InstanceMemento memento = _source.GetMemento("String"); StringGridColumn column = (StringGridColumn) factory.GetInstance(memento); Modified: trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -95,6 +95,7 @@ family.Plugins.Add(typeof (ComplexType<int>), "complex"); InstanceFactory factory = new InstanceFactory(family, true); + factory.SetInstanceManager(new InstanceManager()); MemoryInstanceMemento memento = new MemoryInstanceMemento("complex", "Me"); memento.SetProperty("name", "Jeremy"); Modified: trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -39,8 +39,11 @@ PluginFamily stringFamily = family.CreateTemplatedClone(typeof (string)); InstanceFactory intFactory = new InstanceFactory(intFamily, true); + intFactory.SetInstanceManager(new InstanceManager()); + InstanceFactory stringFactory = new InstanceFactory(stringFamily, true); - + stringFactory.SetInstanceManager(new InstanceManager()); + GenericService<int> intService = (GenericService<int>) intFactory.GetInstance(); Assert.AreEqual(typeof (int), intService.GetT()); Modified: trunk/Source/StructureMap.Testing/ObjectMother.cs =================================================================== --- trunk/Source/StructureMap.Testing/ObjectMother.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/ObjectMother.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -96,7 +96,10 @@ pluginGraph.Seal(); PluginFamily family = pluginGraph.PluginFamilies[pluginType]; - return new InstanceFactory(family, false); + InstanceFactory factory = new InstanceFactory(family, false); + factory.SetInstanceManager(new InstanceManager()); + + return factory; } public static InstanceFactory Factory<T>() Modified: trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -1,5 +1,6 @@ using NUnit.Framework; using Rhino.Mocks; +using StructureMap.Interceptors; using StructureMap.Pipeline; namespace StructureMap.Testing.Pipeline @@ -29,6 +30,7 @@ using (mocks.Record()) { Expect.Call(instanceCreator.CreateInstance(typeof(IDefault))).Return(theDefault); + Expect.Call(instanceCreator.FindInterceptor(theDefault.GetType())).Return(new NulloInterceptor()); } using (mocks.Playback()) Modified: trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -22,7 +22,10 @@ { MockRepository mocks = new MockRepository(); InstanceInterceptor interceptor = mocks.CreateMock<InstanceInterceptor>(); + InstanceInterceptor interceptor2 = mocks.CreateMock<InstanceInterceptor>(); + StructureMap.Pipeline.IInstanceCreator instanceCreator = mocks.CreateMock<StructureMap.Pipeline.IInstanceCreator>(); + InstanceUnderTest instanceUnderTest = new InstanceUnderTest(); instanceUnderTest.Interceptor = interceptor; @@ -30,11 +33,16 @@ using (mocks.Record()) { Expect.Call(interceptor.Process(instanceUnderTest.TheInstanceThatWasBuilt)).Return(objectReturnedByInterceptor); + Expect.Call(instanceCreator.FindInterceptor(instanceUnderTest.TheInstanceThatWasBuilt.GetType())).Return + (interceptor2); + + Expect.Call(interceptor2.Process(objectReturnedByInterceptor)).Return(objectReturnedByInterceptor); } using (mocks.Playback()) { - Assert.AreEqual(objectReturnedByInterceptor, instanceUnderTest.Build(typeof(object), null)); + Assert.AreEqual(objectReturnedByInterceptor, instanceUnderTest.Build(typeof(object), instanceCreator)); + } } Modified: trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -17,7 +17,7 @@ { ATarget target = new ATarget(); LiteralInstance<ITarget> instance = new LiteralInstance<ITarget>(target); - Assert.AreSame(target, instance.Build(typeof(ITarget), null)); + Assert.AreSame(target, instance.Build(typeof(ITarget), new StubInstanceCreator())); } public interface ITarget Modified: trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -19,7 +19,7 @@ PrototypeTarget target = new PrototypeTarget("Jeremy"); PrototypeInstance instance = new PrototypeInstance(target); - object returnedValue = instance.Build(typeof(PrototypeTarget), null); + object returnedValue = instance.Build(typeof(PrototypeTarget), new StubInstanceCreator()); Assert.AreEqual(target, returnedValue); Assert.AreNotSame(target, returnedValue); Modified: trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -1,5 +1,6 @@ using NUnit.Framework; using Rhino.Mocks; +using StructureMap.Interceptors; using StructureMap.Pipeline; namespace StructureMap.Testing.Pipeline @@ -24,6 +25,7 @@ using (mocks.Record()) { + Expect.Call(instanceCreator.FindInterceptor(returnedValue.GetType())).Return(new NulloInterceptor()); Expect.Call(instanceCreator.CreateInstance(typeof(IReferenced), theReferenceKey)).Return(returnedValue); } Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-04-07 14:00:27 UTC (rev 76) @@ -365,11 +365,13 @@ <Compile Include="ObjectMother.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Pipeline\ConfiguredInstanceTester.cs" /> <Compile Include="Pipeline\DefaultInstanceTester.cs" /> <Compile Include="Pipeline\InstanceTester.cs" /> <Compile Include="Pipeline\LiteralInstanceTester.cs" /> <Compile Include="Pipeline\PrototypeInstanceTester.cs" /> <Compile Include="Pipeline\ReferencedInstanceTester.cs" /> + <Compile Include="Pipeline\StubInstanceCreator.cs" /> <Compile Include="StructureMapConfigCreator.cs" /> <Compile Include="StructureMapConfigurationTester.cs" /> <Compile Include="TestData\DataMother.cs"> Modified: trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-06 23:53:49 UTC (rev 75) +++ trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-07 14:00:27 UTC (rev 76) @@ -43,7 +43,7 @@ column.Rules = (Rule[]) - Manager.CreateInstanceArray("StructureMap.Testing.Widget.Rule", instance.GetChildrenArray("Rules")); + creator.CreateInstanceArray("StructureMap.Testing.Widget.Rule", instance.GetChildrenArray("Rules")); // // column.WrapLines = bool.Parse(Memento.GetProperty("WrapLines")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-04-06 23:53:50
|
Revision: 75 http://structuremap.svn.sourceforge.net/structuremap/?rev=75&view=rev Author: jeremydmiller Date: 2008-04-06 16:53:49 -0700 (Sun, 06 Apr 2008) Log Message: ----------- refactoring the new Instance's to use a Type instead of a generic. Alas, it is not a perfect world Modified Paths: -------------- trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs trunk/Source/StructureMap/Pipeline/DefaultInstance.cs trunk/Source/StructureMap/Pipeline/Instance.cs trunk/Source/StructureMap/Pipeline/LiteralInstance.cs trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs trunk/Source/StructureMap/Pipeline/UserControlInstance.cs trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs Modified: trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -11,19 +11,9 @@ public class ConfiguredInstance : Instance { - protected override T build<T>(IInstanceCreator creator) + protected override object build(Type type, IInstanceCreator creator) { throw new NotImplementedException(); } - - public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } - - public override void Describe<T>(IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/DefaultInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/DefaultInstance.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap/Pipeline/DefaultInstance.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -6,19 +6,9 @@ { public class DefaultInstance : Instance { - protected override T build<T>(IInstanceCreator creator) + protected override object build(Type type, IInstanceCreator creator) { - return creator.CreateInstance<T>(); + return creator.CreateInstance(type); } - - public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } - - public override void Describe<T>(IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } } } Modified: trunk/Source/StructureMap/Pipeline/Instance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -7,11 +7,11 @@ { public interface IInstanceCreator { - T CreateInstance<T>(string referenceKey); - T CreateInstance<T>(); + object CreateInstance(Type type, string referenceKey); Array CreateInstanceArray(string pluginType, InstanceMemento[] instanceMementoes); object CreateInstance(string typeName, InstanceMemento memento); object CreateInstance(string typeName); + object CreateInstance(Type type); } public interface IInstanceDiagnostics @@ -35,15 +35,15 @@ set { _interceptor = value; } } - public T Build<T>(IInstanceCreator creator) where T : class + public object Build(Type type, IInstanceCreator creator) { - T rawValue = build<T>(creator); - return (T) _interceptor.Process(rawValue); + object rawValue = build(type, creator); + return _interceptor.Process(rawValue); } - protected abstract T build<T>(IInstanceCreator creator) where T : class; + protected abstract object build(Type type, IInstanceCreator creator); - public abstract void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) where T : class; - public abstract void Describe<T>(IInstanceDiagnostics diagnostics) where T : class; + //public abstract void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) where T : class; + //public abstract void Describe<T>(IInstanceDiagnostics diagnostics) where T : class; } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/LiteralInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/LiteralInstance.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap/Pipeline/LiteralInstance.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -4,7 +4,7 @@ { public class LiteralInstance<PLUGINTYPE> : Instance { - private PLUGINTYPE _object; + private readonly PLUGINTYPE _object; public LiteralInstance(PLUGINTYPE anObject) { @@ -13,22 +13,12 @@ // TODO: VALIDATE NOT NULL } - protected override T build<T>(IInstanceCreator creator) + + protected override object build(Type type, IInstanceCreator creator) { - T returnValue = _object as T; // TODO: VALIDATE THE CAST AND NULL - return returnValue; + return _object; } - - public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } - - public override void Describe<T>(IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -13,20 +13,10 @@ } - protected override T build<T>(IInstanceCreator creator) + protected override object build(Type type, IInstanceCreator creator) { // TODO: VALIDATION IF IT CAN'T BE CAST - return (T) _prototype.Clone(); + return _prototype.Clone(); } - - public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } - - public override void Describe<T>(IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -13,19 +13,10 @@ _referenceKey = referenceKey; } - protected override T build<T>(IInstanceCreator creator) - { - return creator.CreateInstance<T>(_referenceKey); - } - public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + protected override object build(Type type, IInstanceCreator creator) { - throw new NotImplementedException(); + return creator.CreateInstance(type, _referenceKey); } - - public override void Describe<T>(IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Pipeline/UserControlInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/UserControlInstance.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap/Pipeline/UserControlInstance.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -12,20 +12,11 @@ _url = url; } - protected override T build<T>(IInstanceCreator creator) - { - // TODO: VALIDATION if it doesn't cast or can't be built - return new Page().LoadControl(_url) as T; - } - public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + protected override object build(Type type, IInstanceCreator creator) { - throw new NotImplementedException(); + // TODO: VALIDATE that the type works + return new Page().LoadControl(_url); } - - public override void Describe<T>(IInstanceDiagnostics diagnostics) - { - throw new NotImplementedException(); - } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -28,13 +28,13 @@ using (mocks.Record()) { - Expect.Call(instanceCreator.CreateInstance<IDefault>()).Return(theDefault); + Expect.Call(instanceCreator.CreateInstance(typeof(IDefault))).Return(theDefault); } using (mocks.Playback()) { DefaultInstance instance = new DefaultInstance(); - Assert.AreSame(theDefault, instance.Build<IDefault>(instanceCreator)); + Assert.AreSame(theDefault, instance.Build(typeof(IDefault), instanceCreator)); } } Modified: trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -1,3 +1,4 @@ +using System; using NUnit.Framework; using Rhino.Mocks; using StructureMap.Interceptors; @@ -33,7 +34,7 @@ using (mocks.Playback()) { - Assert.AreEqual(objectReturnedByInterceptor, instanceUnderTest.Build<object>(null)); + Assert.AreEqual(objectReturnedByInterceptor, instanceUnderTest.Build(typeof(object), null)); } } @@ -44,19 +45,10 @@ { public object TheInstanceThatWasBuilt = new object(); - public override void Diagnose<T>(StructureMap.Pipeline.IInstanceCreator creator, IInstanceDiagnostics diagnostics) - { - throw new System.NotImplementedException(); - } - public override void Describe<T>(IInstanceDiagnostics diagnostics) + protected override object build(Type type, StructureMap.Pipeline.IInstanceCreator creator) { - throw new System.NotImplementedException(); + return TheInstanceThatWasBuilt; } - - protected override T build<T>(StructureMap.Pipeline.IInstanceCreator creator) - { - return (T) TheInstanceThatWasBuilt; - } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -17,7 +17,7 @@ { ATarget target = new ATarget(); LiteralInstance<ITarget> instance = new LiteralInstance<ITarget>(target); - Assert.AreSame(target, instance.Build<ITarget>(null)); + Assert.AreSame(target, instance.Build(typeof(ITarget), null)); } public interface ITarget Modified: trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -19,7 +19,7 @@ PrototypeTarget target = new PrototypeTarget("Jeremy"); PrototypeInstance instance = new PrototypeInstance(target); - object returnedValue = instance.Build<PrototypeTarget>(null); + object returnedValue = instance.Build(typeof(PrototypeTarget), null); Assert.AreEqual(target, returnedValue); Assert.AreNotSame(target, returnedValue); Modified: trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs 2008-04-06 19:52:39 UTC (rev 74) +++ trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs 2008-04-06 23:53:49 UTC (rev 75) @@ -24,12 +24,12 @@ using (mocks.Record()) { - Expect.Call(instanceCreator.CreateInstance<IReferenced>(theReferenceKey)).Return(returnedValue); + Expect.Call(instanceCreator.CreateInstance(typeof(IReferenced), theReferenceKey)).Return(returnedValue); } using (mocks.Playback()) { - Assert.AreSame(returnedValue, instance.Build<IReferenced>(instanceCreator)); + Assert.AreSame(returnedValue, instance.Build(typeof(IReferenced), instanceCreator)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-04-06 19:52:40
|
Revision: 74 http://structuremap.svn.sourceforge.net/structuremap/?rev=74&view=rev Author: jeremydmiller Date: 2008-04-06 12:52:39 -0700 (Sun, 06 Apr 2008) Log Message: ----------- changing out the construction pipeline Modified Paths: -------------- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs trunk/Source/StructureMap/Emitting/Parameters/ChildArrayParameterEmitter.cs trunk/Source/StructureMap/Emitting/Parameters/ChildParameterEmitter.cs trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs trunk/Source/StructureMap/Pipeline/Instance.cs trunk/Source/StructureMap.Testing.Widget/Decision.cs trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs Modified: trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -54,10 +54,10 @@ return _inner.GetChildMemento(Key); } - public override object GetChild(string key, string typeName, InstanceManager manager) + public override object GetChild(string key, string typeName, Pipeline.IInstanceCreator instanceCreator) { Type type = Type.GetType(typeName, true); - return _args.Get(type) ?? base.GetChild(key, typeName, manager); + return _args.Get(type) ?? base.GetChild(key, typeName, instanceCreator); } public override InstanceMemento[] GetChildrenArray(string Key) Modified: trunk/Source/StructureMap/Emitting/Parameters/ChildArrayParameterEmitter.cs =================================================================== --- trunk/Source/StructureMap/Emitting/Parameters/ChildArrayParameterEmitter.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/Emitting/Parameters/ChildArrayParameterEmitter.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -33,15 +33,14 @@ private void putChildArrayFromInstanceMementoOntoStack(ILGenerator ilgen, Type argumentType, string argumentName) { - ilgen.Emit(OpCodes.Ldarg_0); - callGetInstanceManager(ilgen); + ilgen.Emit(OpCodes.Ldarg_2); ilgen.Emit(OpCodes.Ldstr, argumentType.GetElementType().AssemblyQualifiedName); ilgen.Emit(OpCodes.Ldarg_1); ilgen.Emit(OpCodes.Ldstr, argumentName); callInstanceMemento(ilgen, "GetChildrenArray"); - MethodInfo methodCreateInstanceArray = (typeof (InstanceManager).GetMethod("CreateInstanceArray")); + MethodInfo methodCreateInstanceArray = (typeof (StructureMap.Pipeline.IInstanceCreator).GetMethod("CreateInstanceArray")); ilgen.Emit(OpCodes.Callvirt, methodCreateInstanceArray); cast(ilgen, argumentType); } Modified: trunk/Source/StructureMap/Emitting/Parameters/ChildParameterEmitter.cs =================================================================== --- trunk/Source/StructureMap/Emitting/Parameters/ChildParameterEmitter.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/Emitting/Parameters/ChildParameterEmitter.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -30,9 +30,8 @@ ilgen.Emit(OpCodes.Ldarg_1); ilgen.Emit(OpCodes.Ldstr, parameterName); ilgen.Emit(OpCodes.Ldstr, fullName); - ilgen.Emit(OpCodes.Ldarg_0); + ilgen.Emit(OpCodes.Ldarg_2); - callGetInstanceManager(ilgen); callInstanceMemento(ilgen, "GetChild"); cast(ilgen, parameterType); } Modified: trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs =================================================================== --- trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -79,13 +79,6 @@ ilgen.Emit(OpCodes.Callvirt, _method); } - protected void callGetInstanceManager(ILGenerator ilgen) - { - PropertyInfo property = (typeof (InstanceBuilder)).GetProperty("Manager"); - MethodInfo methodGetInstanceManager = property.GetGetMethod(); - ilgen.Emit(OpCodes.Call, methodGetInstanceManager); - } - protected void cast(ILGenerator ilgen, Type parameterType) { ilgen.Emit(OpCodes.Castclass, parameterType); Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -145,7 +145,7 @@ try { InstanceBuilder builder = _instanceBuilders[memento.ConcreteKey]; - object constructedInstance = builder.BuildInstance(memento, null); + object constructedInstance = builder.BuildInstance(memento, builder.Manager); CompoundInterceptor interceptor = _interceptorLibrary.FindInterceptor(constructedInstance.GetType()); return interceptor.Process(constructedInstance); } Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -12,7 +12,7 @@ /// <summary> /// A collection of IInstanceFactory's. /// </summary> - public class InstanceManager : IInstanceManager, IEnumerable + public class InstanceManager : IInstanceManager, IEnumerable, StructureMap.Pipeline.IInstanceCreator { private readonly InstanceDefaultManager _defaultManager; private readonly Dictionary<Type, IInstanceFactory> _factories; Modified: trunk/Source/StructureMap/InstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/InstanceMemento.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/InstanceMemento.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -187,27 +187,27 @@ /// </summary> /// <param name="key"></param> /// <param name="typeName"></param> - /// <param name="manager"></param> + /// <param name="instanceCreator"></param> /// <returns></returns> - public virtual object GetChild(string key, string typeName, InstanceManager manager) + public virtual object GetChild(string key, string typeName, Pipeline.IInstanceCreator instanceCreator) { InstanceMemento memento = GetChildMemento(key); object returnValue = null; if (memento == null) { - returnValue = buildDefaultChild(key, manager, typeName); + returnValue = buildDefaultChild(key, instanceCreator, typeName); } else { - returnValue = manager.CreateInstance(typeName, memento); + returnValue = instanceCreator.CreateInstance(typeName, memento); } return returnValue; } - private static object buildDefaultChild(string key, InstanceManager manager, string typeName) + private static object buildDefaultChild(string key, StructureMap.Pipeline.IInstanceCreator manager, string typeName) { object returnValue; try Modified: trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -6,7 +6,7 @@ { InstanceMemento[] GetChildrenArray(string propertyName); string GetProperty(string propertyName); - object GetChild(string propertyName, string typeName, InstanceManager manager); + object GetChild(string propertyName, string typeName, IInstanceCreator instanceCreator); } public class ConfiguredInstance : Instance Modified: trunk/Source/StructureMap/Pipeline/Instance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -1,4 +1,5 @@ using System; +using System.Data; using System.Web.UI; using StructureMap.Interceptors; @@ -8,6 +9,9 @@ { T CreateInstance<T>(string referenceKey); T CreateInstance<T>(); + Array CreateInstanceArray(string pluginType, InstanceMemento[] instanceMementoes); + object CreateInstance(string typeName, InstanceMemento memento); + object CreateInstance(string typeName); } public interface IInstanceDiagnostics Modified: trunk/Source/StructureMap.Testing.Widget/Decision.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -34,7 +34,7 @@ public override object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator) { return new Decision( - (Rule[]) Manager.CreateInstanceArray("StructureMap.Testing.Widget", instance.GetChildrenArray("Rules"))); + (Rule[]) creator.CreateInstanceArray("StructureMap.Testing.Widget", instance.GetChildrenArray("Rules"))); } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 19:13:08 UTC (rev 73) +++ trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 19:52:39 UTC (rev 74) @@ -112,7 +112,7 @@ { return new Child( instance.GetProperty("Name"), - (GrandChild) instance.GetChild("MyGrandChild", "StructureMap.Testing.Widget.GrandChild", Manager)); + (GrandChild) instance.GetChild("MyGrandChild", "StructureMap.Testing.Widget.GrandChild", creator)); } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-04-06 19:13:16
|
Revision: 73 http://structuremap.svn.sourceforge.net/structuremap/?rev=73&view=rev Author: jeremydmiller Date: 2008-04-06 12:13:08 -0700 (Sun, 06 Apr 2008) Log Message: ----------- refactoring the emitting code Modified Paths: -------------- trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs trunk/Source/StructureMap/InstanceBuilder.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap.Testing/Container/EmittingTester.cs trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs trunk/Source/StructureMap.Testing.Widget/Decision.cs trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs Modified: trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs =================================================================== --- trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -33,7 +33,7 @@ public override Type[] ArgumentList { - get { return new Type[] {typeof (IConfiguredInstance)}; } + get { return new Type[] { typeof(IConfiguredInstance), typeof(StructureMap.Pipeline.IInstanceCreator) }; } } public override string MethodName Modified: trunk/Source/StructureMap/InstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap/InstanceBuilder.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap/InstanceBuilder.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -24,7 +24,7 @@ get { return _manager; } } - public abstract object BuildInstance(IConfiguredInstance instance); + public abstract object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator); public void SetInstanceManager(InstanceManager manager) { Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -145,7 +145,7 @@ try { InstanceBuilder builder = _instanceBuilders[memento.ConcreteKey]; - object constructedInstance = builder.BuildInstance(memento); + object constructedInstance = builder.BuildInstance(memento, null); CompoundInterceptor interceptor = _interceptorLibrary.FindInterceptor(constructedInstance.GetType()); return interceptor.Process(constructedInstance); } Modified: trunk/Source/StructureMap.Testing/Container/EmittingTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/EmittingTester.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap.Testing/Container/EmittingTester.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using System.Reflection; using NUnit.Framework; using StructureMap.Emitting; @@ -36,12 +37,13 @@ if (builder != null) { - rule = (ComplexRule) builder.BuildInstance(memento); + rule = (ComplexRule) builder.BuildInstance(memento, null); } } catch (Exception e) { ex = e; + Debug.WriteLine(e.ToString()); } } Modified: trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -68,7 +68,7 @@ } - public override object BuildInstance(IConfiguredInstance instance) + public override object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator) { return null; } Modified: trunk/Source/StructureMap.Testing.Widget/Decision.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -31,7 +31,7 @@ get { return null; } } - public override object BuildInstance(IConfiguredInstance instance) + public override object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator) { return new Decision( (Rule[]) Manager.CreateInstanceArray("StructureMap.Testing.Widget", instance.GetChildrenArray("Rules"))); Modified: trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -108,7 +108,7 @@ } - public override object BuildInstance(IConfiguredInstance instance) + public override object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator) { return new Child( instance.GetProperty("Name"), Modified: trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -45,7 +45,7 @@ } - public override object BuildInstance(IConfiguredInstance instance) + public override object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator) { return new Cow( long.Parse(instance.GetProperty("Weight")), Modified: trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-06 19:02:29 UTC (rev 72) +++ trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-06 19:13:08 UTC (rev 73) @@ -29,7 +29,7 @@ get { throw new NotImplementedException(); } } - public override object BuildInstance(IConfiguredInstance instance) + public override object BuildInstance(IConfiguredInstance instance, StructureMap.Pipeline.IInstanceCreator creator) { BasicGridColumn column = new BasicGridColumn(instance.GetProperty("headerText")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-04-06 19:02:31
|
Revision: 72 http://structuremap.svn.sourceforge.net/structuremap/?rev=72&view=rev Author: jeremydmiller Date: 2008-04-06 12:02:29 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Substituted in the IConfiguredInstance into the construction pipeline instead of InstanceMemento Modified Paths: -------------- trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs trunk/Source/StructureMap/Emitting/ClassBuilder.cs trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs trunk/Source/StructureMap/InstanceBuilder.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs trunk/Source/StructureMap.Testing.Widget/Decision.cs trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs Modified: trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs =================================================================== --- trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap/Emitting/BuildInstanceMethod.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -3,6 +3,7 @@ using System.Reflection.Emit; using StructureMap.Emitting.Parameters; using StructureMap.Graph; +using StructureMap.Pipeline; namespace StructureMap.Emitting { @@ -13,8 +14,8 @@ public class BuildInstanceMethod : Method { private readonly Plugin _plugin; - private ConstructorInfo _constructor; - private ParameterEmitter _parameterEmitter; + private readonly ConstructorInfo _constructor; + private readonly ParameterEmitter _parameterEmitter; public BuildInstanceMethod(Plugin plugin) : base() { @@ -32,7 +33,7 @@ public override Type[] ArgumentList { - get { return new Type[] {typeof (InstanceMemento)}; } + get { return new Type[] {typeof (IConfiguredInstance)}; } } public override string MethodName Modified: trunk/Source/StructureMap/Emitting/ClassBuilder.cs =================================================================== --- trunk/Source/StructureMap/Emitting/ClassBuilder.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap/Emitting/ClassBuilder.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -13,13 +13,13 @@ private const TypeAttributes PUBLIC_ATTS = TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.BeforeFieldInit; - private string _ClassName; + private readonly string _className; - private ArrayList _Methods; - private TypeBuilder newTypeBuilder; - private Type superType; + private readonly ArrayList _methods; + private readonly TypeBuilder _newTypeBuilder; + private readonly Type _superType; - public ClassBuilder(ModuleBuilder module, string ClassName) : this(module, ClassName, typeof (Object)) + public ClassBuilder(ModuleBuilder module, string className) : this(module, className, typeof (Object)) { } @@ -27,11 +27,11 @@ { try { - _Methods = new ArrayList(); + _methods = new ArrayList(); - newTypeBuilder = module.DefineType(ClassName, PUBLIC_ATTS, superType); - this.superType = superType; - _ClassName = ClassName; + _newTypeBuilder = module.DefineType(ClassName, PUBLIC_ATTS, superType); + _superType = superType; + _className = ClassName; addDefaultConstructor(); } @@ -44,25 +44,25 @@ public string ClassName { - get { return _ClassName; } + get { return _className; } } public void AddMethod(Method method) { - _Methods.Add(method); - method.Attach(newTypeBuilder); + _methods.Add(method); + method.Attach(_newTypeBuilder); } internal void Bake() { - foreach (Method method in _Methods) + foreach (Method method in _methods) { method.Build(); } - newTypeBuilder.CreateType(); + _newTypeBuilder.CreateType(); } @@ -71,14 +71,14 @@ MethodAttributes atts = MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig | MethodAttributes.RTSpecialName; - ConstructorBuilder construct = newTypeBuilder.DefineConstructor(atts, CallingConventions.Standard, null); + ConstructorBuilder construct = _newTypeBuilder.DefineConstructor(atts, CallingConventions.Standard, null); ILGenerator ilgen = construct.GetILGenerator(); ilgen.Emit(OpCodes.Ldarg_0); - ConstructorInfo constructor = superType.GetConstructor(new Type[0]); + ConstructorInfo constructor = _superType.GetConstructor(new Type[0]); ilgen.Emit(OpCodes.Call, constructor); ilgen.Emit(OpCodes.Ret); } @@ -87,7 +87,7 @@ public void AddReadonlyStringProperty(string PropertyName, string Value, bool Override) { PropertyBuilder prop = - newTypeBuilder.DefineProperty(PropertyName, PropertyAttributes.HasDefault, typeof (string), null); + _newTypeBuilder.DefineProperty(PropertyName, PropertyAttributes.HasDefault, typeof (string), null); MethodAttributes atts = MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig | MethodAttributes.Final | MethodAttributes.SpecialName; @@ -95,7 +95,7 @@ string _GetMethodName = "get_" + PropertyName; MethodBuilder methodGet = - newTypeBuilder.DefineMethod(_GetMethodName, atts, CallingConventions.Standard, typeof (string), null); + _newTypeBuilder.DefineMethod(_GetMethodName, atts, CallingConventions.Standard, typeof (string), null); ILGenerator gen = methodGet.GetILGenerator(); LocalBuilder ilReturn = gen.DeclareLocal(typeof (string)); Modified: trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs =================================================================== --- trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap/Emitting/Parameters/ParameterEmitter.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -1,6 +1,7 @@ using System; using System.Reflection; using System.Reflection.Emit; +using StructureMap.Pipeline; namespace StructureMap.Emitting.Parameters { @@ -11,12 +12,12 @@ /// </summary> public abstract class ParameterEmitter { - private ParameterEmitter _NextSibling; + private ParameterEmitter _nextSibling; protected ParameterEmitter NextSibling { - set { _NextSibling = value; } - get { return _NextSibling; } + set { _nextSibling = value; } + get { return _nextSibling; } } public void Generate(ILGenerator ilgen, ParameterInfo parameter) @@ -25,9 +26,9 @@ { generate(ilgen, parameter); } - else if (_NextSibling != null) + else if (_nextSibling != null) { - _NextSibling.Generate(ilgen, parameter); + _nextSibling.Generate(ilgen, parameter); } else { @@ -44,9 +45,9 @@ { generateSetter(ilgen, property); } - else if (_NextSibling != null) + else if (_nextSibling != null) { - _NextSibling.GenerateSetter(ilgen, property); + _nextSibling.GenerateSetter(ilgen, property); } else { @@ -72,9 +73,9 @@ protected abstract bool canProcess(Type parameterType); protected abstract void generate(ILGenerator ilgen, ParameterInfo parameter); - protected void callInstanceMemento(ILGenerator ilgen, string MethodName) + protected void callInstanceMemento(ILGenerator ilgen, string methodName) { - MethodInfo _method = typeof (InstanceMemento).GetMethod(MethodName); + MethodInfo _method = typeof (IConfiguredInstance).GetMethod(methodName); ilgen.Emit(OpCodes.Callvirt, _method); } Modified: trunk/Source/StructureMap/InstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap/InstanceBuilder.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap/InstanceBuilder.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -1,4 +1,5 @@ using System; +using StructureMap.Pipeline; namespace StructureMap { @@ -23,7 +24,7 @@ get { return _manager; } } - public abstract object BuildInstance(InstanceMemento memento); + public abstract object BuildInstance(IConfiguredInstance instance); public void SetInstanceManager(InstanceManager manager) { @@ -35,10 +36,5 @@ Type plugged = Type.GetType(PluggedType); return plugged.Equals(type); } - - //public Type GetPluggedType() - //{ - // return Type.GetType(PluggedType); - //} } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/InstanceMemento.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap/InstanceMemento.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -2,13 +2,14 @@ using StructureMap.Configuration; using StructureMap.Graph; using StructureMap.Interceptors; +using StructureMap.Pipeline; namespace StructureMap { /// <summary> /// GoF Memento representing an Object Instance /// </summary> - public abstract class InstanceMemento + public abstract class InstanceMemento : IConfiguredInstance { public const string EMPTY_STRING = "STRING.EMPTY"; public const string SUBSTITUTIONS_ATTRIBUTE = "Substitutions"; Modified: trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -1,18 +1,16 @@ using System; -using System.Collections.Generic; -using System.Text; namespace StructureMap.Pipeline { public interface IConfiguredInstance { - + InstanceMemento[] GetChildrenArray(string propertyName); + string GetProperty(string propertyName); + object GetChild(string propertyName, string typeName, InstanceManager manager); } public class ConfiguredInstance : Instance { - - protected override T build<T>(IInstanceCreator creator) { throw new NotImplementedException(); @@ -28,4 +26,4 @@ throw new NotImplementedException(); } } -} +} \ No newline at end of file Modified: trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -68,7 +68,7 @@ } - public override object BuildInstance(InstanceMemento memento) + public override object BuildInstance(IConfiguredInstance instance) { return null; } Modified: trunk/Source/StructureMap.Testing.Widget/Decision.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -31,10 +31,10 @@ get { return null; } } - public override object BuildInstance(InstanceMemento memento) + public override object BuildInstance(IConfiguredInstance instance) { return new Decision( - (Rule[]) Manager.CreateInstanceArray("StructureMap.Testing.Widget", memento.GetChildrenArray("Rules"))); + (Rule[]) Manager.CreateInstanceArray("StructureMap.Testing.Widget", instance.GetChildrenArray("Rules"))); } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -108,7 +108,7 @@ } - public override object BuildInstance(InstanceMemento instance) + public override object BuildInstance(IConfiguredInstance instance) { return new Child( instance.GetProperty("Name"), Modified: trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -45,7 +45,7 @@ } - public override object BuildInstance(InstanceMemento instance) + public override object BuildInstance(IConfiguredInstance instance) { return new Cow( long.Parse(instance.GetProperty("Weight")), Modified: trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-06 18:45:47 UTC (rev 71) +++ trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-06 19:02:29 UTC (rev 72) @@ -29,7 +29,7 @@ get { throw new NotImplementedException(); } } - public override object BuildInstance(InstanceMemento instance) + public override object BuildInstance(IConfiguredInstance instance) { BasicGridColumn column = new BasicGridColumn(instance.GetProperty("headerText")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-04-06 18:45:52
|
Revision: 71 http://structuremap.svn.sourceforge.net/structuremap/?rev=71&view=rev Author: jeremydmiller Date: 2008-04-06 11:45:47 -0700 (Sun, 06 Apr 2008) Log Message: ----------- start of the new Pipeline Modified Paths: -------------- trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs trunk/Source/StructureMap.Testing.Widget/Decision.cs trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs Added Paths: ----------- trunk/Source/StructureMap/Pipeline/ trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs trunk/Source/StructureMap/Pipeline/DefaultInstance.cs trunk/Source/StructureMap/Pipeline/Instance.cs trunk/Source/StructureMap/Pipeline/LiteralInstance.cs trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs trunk/Source/StructureMap/Pipeline/UserControlInstance.cs trunk/Source/StructureMap.Testing/Pipeline/ trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs Property Changed: ---------------- trunk/Source/ Property changes on: trunk/Source ___________________________________________________________________ Name: svn:ignore - *.suo _ReSharper.StructureMap PrecompiledWeb *.resharper *.user + *.suo _ReSharper.StructureMap PrecompiledWeb *.resharper *.user Ankh.Load _UpgradeReport_Files UpgradeLog.XML UpgradeLog2.XML UpgradeLog3.XML UpgradeLog4.XML Added: trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs (rev 0) +++ trunk/Source/StructureMap/Pipeline/ConfiguredInstance.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureMap.Pipeline +{ + public interface IConfiguredInstance + { + + } + + public class ConfiguredInstance : Instance + { + + + protected override T build<T>(IInstanceCreator creator) + { + throw new NotImplementedException(); + } + + public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + + public override void Describe<T>(IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + } +} Added: trunk/Source/StructureMap/Pipeline/DefaultInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/DefaultInstance.cs (rev 0) +++ trunk/Source/StructureMap/Pipeline/DefaultInstance.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureMap.Pipeline +{ + public class DefaultInstance : Instance + { + protected override T build<T>(IInstanceCreator creator) + { + return creator.CreateInstance<T>(); + } + + public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + + public override void Describe<T>(IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + } +} Added: trunk/Source/StructureMap/Pipeline/Instance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/Instance.cs (rev 0) +++ trunk/Source/StructureMap/Pipeline/Instance.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,45 @@ +using System; +using System.Web.UI; +using StructureMap.Interceptors; + +namespace StructureMap.Pipeline +{ + public interface IInstanceCreator + { + T CreateInstance<T>(string referenceKey); + T CreateInstance<T>(); + } + + public interface IInstanceDiagnostics + { + } + + public abstract class Instance + { + private string _name; + private InstanceInterceptor _interceptor = new NulloInterceptor(); + + public string Name + { + get { return _name; } + set { _name = value; } + } + + public InstanceInterceptor Interceptor + { + get { return _interceptor; } + set { _interceptor = value; } + } + + public T Build<T>(IInstanceCreator creator) where T : class + { + T rawValue = build<T>(creator); + return (T) _interceptor.Process(rawValue); + } + + protected abstract T build<T>(IInstanceCreator creator) where T : class; + + public abstract void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) where T : class; + public abstract void Describe<T>(IInstanceDiagnostics diagnostics) where T : class; + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Pipeline/LiteralInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/LiteralInstance.cs (rev 0) +++ trunk/Source/StructureMap/Pipeline/LiteralInstance.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,34 @@ +using System; + +namespace StructureMap.Pipeline +{ + public class LiteralInstance<PLUGINTYPE> : Instance + { + private PLUGINTYPE _object; + + public LiteralInstance(PLUGINTYPE anObject) + { + _object = anObject; + + // TODO: VALIDATE NOT NULL + } + + protected override T build<T>(IInstanceCreator creator) + { + T returnValue = _object as T; + // TODO: VALIDATE THE CAST AND NULL + + return returnValue; + } + + public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + + public override void Describe<T>(IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs (rev 0) +++ trunk/Source/StructureMap/Pipeline/PrototypeInstance.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,32 @@ +using System; + +namespace StructureMap.Pipeline +{ + public class PrototypeInstance : Instance + { + private ICloneable _prototype; + + + public PrototypeInstance(ICloneable prototype) + { + _prototype = prototype; + } + + + protected override T build<T>(IInstanceCreator creator) + { + // TODO: VALIDATION IF IT CAN'T BE CAST + return (T) _prototype.Clone(); + } + + public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + + public override void Describe<T>(IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs (rev 0) +++ trunk/Source/StructureMap/Pipeline/ReferencedInstance.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,31 @@ +using System; + +namespace StructureMap.Pipeline +{ + public class ReferencedInstance : Instance + { + private readonly string _referenceKey; + + + public ReferencedInstance(string referenceKey) + { + // TODO: VALIDATION if referenceKey is null or empty + _referenceKey = referenceKey; + } + + protected override T build<T>(IInstanceCreator creator) + { + return creator.CreateInstance<T>(_referenceKey); + } + + public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + + public override void Describe<T>(IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Pipeline/UserControlInstance.cs =================================================================== --- trunk/Source/StructureMap/Pipeline/UserControlInstance.cs (rev 0) +++ trunk/Source/StructureMap/Pipeline/UserControlInstance.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,31 @@ +using System; +using System.Web.UI; + +namespace StructureMap.Pipeline +{ + public class UserControlInstance : Instance + { + private readonly string _url; + + public UserControlInstance(string url) + { + _url = url; + } + + protected override T build<T>(IInstanceCreator creator) + { + // TODO: VALIDATION if it doesn't cast or can't be built + return new Page().LoadControl(_url) as T; + } + + public override void Diagnose<T>(IInstanceCreator creator, IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + + public override void Describe<T>(IInstanceDiagnostics diagnostics) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-04-06 16:26:03 UTC (rev 70) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-04-06 18:45:47 UTC (rev 71) @@ -115,6 +115,13 @@ <Link>CommonAssemblyInfo.cs</Link> <SubType>Code</SubType> </Compile> + <Compile Include="Pipeline\ConfiguredInstance.cs" /> + <Compile Include="Pipeline\DefaultInstance.cs" /> + <Compile Include="Pipeline\Instance.cs" /> + <Compile Include="Pipeline\LiteralInstance.cs" /> + <Compile Include="Pipeline\PrototypeInstance.cs" /> + <Compile Include="Pipeline\ReferencedInstance.cs" /> + <Compile Include="Pipeline\UserControlInstance.cs" /> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> Added: trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Pipeline/DefaultInstanceTester.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,44 @@ +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Pipeline; + +namespace StructureMap.Testing.Pipeline +{ + [TestFixture] + public class DefaultInstanceTester + { + #region Setup/Teardown + + [SetUp] + public void SetUp() + { + } + + #endregion + + [Test] + public void Build_happy_path() + { + MockRepository mocks = new MockRepository(); + StructureMap.Pipeline.IInstanceCreator instanceCreator = + mocks.CreateMock<StructureMap.Pipeline.IInstanceCreator>(); + + DefaultClass theDefault = new DefaultClass(); + + + using (mocks.Record()) + { + Expect.Call(instanceCreator.CreateInstance<IDefault>()).Return(theDefault); + } + + using (mocks.Playback()) + { + DefaultInstance instance = new DefaultInstance(); + Assert.AreSame(theDefault, instance.Build<IDefault>(instanceCreator)); + } + } + + public interface IDefault {} + public class DefaultClass : IDefault {} + } +} \ No newline at end of file Added: trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Pipeline/InstanceTester.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,62 @@ +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Interceptors; +using StructureMap.Pipeline; +using StructureMap.Testing.Container.Interceptors; + +namespace StructureMap.Testing.Pipeline +{ + [TestFixture] + public class InstanceTester + { + #region Setup/Teardown + + [SetUp] + public void SetUp() + { + } + + [Test] + public void Instance_Build_Calls_into_its_Interceptor() + { + MockRepository mocks = new MockRepository(); + InstanceInterceptor interceptor = mocks.CreateMock<InstanceInterceptor>(); + + InstanceUnderTest instanceUnderTest = new InstanceUnderTest(); + instanceUnderTest.Interceptor = interceptor; + + object objectReturnedByInterceptor = new object(); + using (mocks.Record()) + { + Expect.Call(interceptor.Process(instanceUnderTest.TheInstanceThatWasBuilt)).Return(objectReturnedByInterceptor); + } + + using (mocks.Playback()) + { + Assert.AreEqual(objectReturnedByInterceptor, instanceUnderTest.Build<object>(null)); + } + } + + #endregion + } + + public class InstanceUnderTest : Instance + { + public object TheInstanceThatWasBuilt = new object(); + + public override void Diagnose<T>(StructureMap.Pipeline.IInstanceCreator creator, IInstanceDiagnostics diagnostics) + { + throw new System.NotImplementedException(); + } + + public override void Describe<T>(IInstanceDiagnostics diagnostics) + { + throw new System.NotImplementedException(); + } + + protected override T build<T>(StructureMap.Pipeline.IInstanceCreator creator) + { + return (T) TheInstanceThatWasBuilt; + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Pipeline/LiteralInstanceTester.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,36 @@ +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Pipeline; + +namespace StructureMap.Testing.Pipeline +{ + [TestFixture] + public class LiteralInstanceTester + { + [SetUp] + public void SetUp() + { + } + + [Test] + public void Build_happy_path() + { + ATarget target = new ATarget(); + LiteralInstance<ITarget> instance = new LiteralInstance<ITarget>(target); + Assert.AreSame(target, instance.Build<ITarget>(null)); + } + + public interface ITarget + { + + } + + public class ATarget : ITarget + { + public override string ToString() + { + return "the description of ATarget"; + } + } + } +} Added: trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Pipeline/PrototypeInstanceTester.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,68 @@ +using System; +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Pipeline; + +namespace StructureMap.Testing.Pipeline +{ + [TestFixture] + public class PrototypeInstanceTester + { + [SetUp] + public void SetUp() + { + } + + [Test] + public void Build_a_clone() + { + PrototypeTarget target = new PrototypeTarget("Jeremy"); + PrototypeInstance instance = new PrototypeInstance(target); + + object returnedValue = instance.Build<PrototypeTarget>(null); + + Assert.AreEqual(target, returnedValue); + Assert.AreNotSame(target, returnedValue); + } + + public class PrototypeTarget : ICloneable, IEquatable<PrototypeTarget> + { + private string _name; + + + public PrototypeTarget(string name) + { + _name = name; + } + + public string Name + { + get { return _name; } + set { _name = value; } + } + + + public bool Equals(PrototypeTarget prototypeTarget) + { + if (prototypeTarget == null) return false; + return Equals(_name, prototypeTarget._name); + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(this, obj)) return true; + return Equals(obj as PrototypeTarget); + } + + public override int GetHashCode() + { + return _name != null ? _name.GetHashCode() : 0; + } + + public object Clone() + { + return this.MemberwiseClone(); + } + } + } +} Added: trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Pipeline/ReferencedInstanceTester.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -0,0 +1,43 @@ +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Pipeline; + +namespace StructureMap.Testing.Pipeline +{ + [TestFixture] + public class ReferencedInstanceTester + { + [SetUp] + public void SetUp() + { + } + + [Test] + public void Create_referenced_instance_happy_path() + { + MockRepository mocks = new MockRepository(); + StructureMap.Pipeline.IInstanceCreator instanceCreator = mocks.CreateMock<StructureMap.Pipeline.IInstanceCreator>(); + + ConcreteReferenced returnedValue = new ConcreteReferenced(); + string theReferenceKey = "theReferenceKey"; + ReferencedInstance instance = new ReferencedInstance(theReferenceKey); + + using (mocks.Record()) + { + Expect.Call(instanceCreator.CreateInstance<IReferenced>(theReferenceKey)).Return(returnedValue); + } + + using (mocks.Playback()) + { + Assert.AreSame(returnedValue, instance.Build<IReferenced>(instanceCreator)); + } + } + + public interface IReferenced + { + + } + + public class ConcreteReferenced : IReferenced{} + } +} Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-04-06 16:26:03 UTC (rev 70) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-04-06 18:45:47 UTC (rev 71) @@ -365,6 +365,11 @@ <Compile Include="ObjectMother.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Pipeline\DefaultInstanceTester.cs" /> + <Compile Include="Pipeline\InstanceTester.cs" /> + <Compile Include="Pipeline\LiteralInstanceTester.cs" /> + <Compile Include="Pipeline\PrototypeInstanceTester.cs" /> + <Compile Include="Pipeline\ReferencedInstanceTester.cs" /> <Compile Include="StructureMapConfigCreator.cs" /> <Compile Include="StructureMapConfigurationTester.cs" /> <Compile Include="TestData\DataMother.cs"> Modified: trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs 2008-04-06 16:26:03 UTC (rev 70) +++ trunk/Source/StructureMap.Testing.Widget/ArrayConstruction.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -1,3 +1,5 @@ +using StructureMap.Pipeline; + namespace StructureMap.Testing.Widget { public interface IList Modified: trunk/Source/StructureMap.Testing.Widget/Decision.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 16:26:03 UTC (rev 70) +++ trunk/Source/StructureMap.Testing.Widget/Decision.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -1,3 +1,5 @@ +using StructureMap.Pipeline; + namespace StructureMap.Testing.Widget { public class Decision Modified: trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 16:26:03 UTC (rev 70) +++ trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -1,3 +1,5 @@ +using StructureMap.Pipeline; + namespace StructureMap.Testing.Widget { [PluginFamily, Pluggable("Default", "")] @@ -106,11 +108,11 @@ } - public override object BuildInstance(InstanceMemento memento) + public override object BuildInstance(InstanceMemento instance) { return new Child( - memento.GetProperty("Name"), - (GrandChild) memento.GetChild("MyGrandChild", "StructureMap.Testing.Widget.GrandChild", Manager)); + instance.GetProperty("Name"), + (GrandChild) instance.GetChild("MyGrandChild", "StructureMap.Testing.Widget.GrandChild", Manager)); } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs 2008-04-06 16:26:03 UTC (rev 70) +++ trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -1,4 +1,5 @@ using System; +using StructureMap.Pipeline; namespace StructureMap.Testing.Widget2 { @@ -44,12 +45,12 @@ } - public override object BuildInstance(InstanceMemento memento) + public override object BuildInstance(InstanceMemento instance) { return new Cow( - long.Parse(memento.GetProperty("Weight")), - (BreedEnum) Enum.Parse(typeof (BreedEnum), memento.GetProperty("Breed"), true), - memento.GetProperty("Name")); + long.Parse(instance.GetProperty("Weight")), + (BreedEnum) Enum.Parse(typeof (BreedEnum), instance.GetProperty("Breed"), true), + instance.GetProperty("Name")); } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-06 16:26:03 UTC (rev 70) +++ trunk/Source/StructureMap.Testing.Widget5/BasicGridColumnInstanceBuilder.cs 2008-04-06 18:45:47 UTC (rev 71) @@ -1,4 +1,5 @@ using System; +using StructureMap.Pipeline; using StructureMap.Testing.Widget; namespace StructureMap.Testing.Widget5 @@ -28,9 +29,9 @@ get { throw new NotImplementedException(); } } - public override object BuildInstance(InstanceMemento memento) + public override object BuildInstance(InstanceMemento instance) { - BasicGridColumn column = new BasicGridColumn(memento.GetProperty("headerText")); + BasicGridColumn column = new BasicGridColumn(instance.GetProperty("headerText")); // column.Widget = // (IWidget) Memento.GetChild("Widget", "StructureMap.Testing.Widget.IWidget", this.Manager); @@ -42,7 +43,7 @@ column.Rules = (Rule[]) - Manager.CreateInstanceArray("StructureMap.Testing.Widget.Rule", memento.GetChildrenArray("Rules")); + Manager.CreateInstanceArray("StructureMap.Testing.Widget.Rule", instance.GetChildrenArray("Rules")); // // column.WrapLines = bool.Parse(Memento.GetProperty("WrapLines")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-04-06 16:26:11
|
Revision: 70 http://structuremap.svn.sourceforge.net/structuremap/?rev=70&view=rev Author: jeremydmiller Date: 2008-04-06 09:26:03 -0700 (Sun, 06 Apr 2008) Log Message: ----------- cleaning out trash code and reformatting code Modified Paths: -------------- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs trunk/Source/StructureMap/Configuration/FamilyParser.cs trunk/Source/StructureMap/Configuration/IGraphBuilder.cs trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs trunk/Source/StructureMap/Configuration/ProfileAndMachineParser.cs trunk/Source/StructureMap/Graph/MachineOverride.cs trunk/Source/StructureMap/Graph/Profile.cs trunk/Source/StructureMap/IInstanceCreator.cs trunk/Source/StructureMap/IPluginGraphSource.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/MementoSource.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap/PluginGraphBuilder.cs trunk/Source/StructureMap/Properties/AssemblyInfo.cs trunk/Source/StructureMap/Source/TemplatedMementoSource.cs trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs trunk/Source/StructureMap/Source/XmlTemplater.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs trunk/Source/StructureMap.Testing/Configuration/FamilyParserTester.cs trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/MockTypeInterceptor.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/Source/StructureMap.Testing/TestData/DataMother.cs Removed Paths: ------------- trunk/Source/StructureMap/Configuration/DiagnosticGraphBuilder.cs trunk/Source/StructureMap/Configuration/GraphObject.cs trunk/Source/StructureMap/Configuration/GraphObjectIterator.cs trunk/Source/StructureMap/Configuration/IConfigurationVisitor.cs trunk/Source/StructureMap/Configuration/IInstanceValidator.cs trunk/Source/StructureMap/Configuration/InstanceValidator.cs trunk/Source/StructureMap/Configuration/PluginGraphReport.cs trunk/Source/StructureMap/Configuration/ProblemFinder.cs trunk/Source/StructureMap/Configuration/Tokens/ trunk/Source/StructureMap/DeploymentTasks/ trunk/Source/StructureMap/Graph/RemoteGraph.cs trunk/Source/StructureMap/Graph/RemoteGraphContainer.cs trunk/Source/StructureMap/Verification/ trunk/Source/StructureMap.DeploymentTasks/Deployment.cs trunk/Source/StructureMap.DeploymentTasks/DumbConfigMergeTask.cs trunk/Source/StructureMap.DeploymentTasks/ImportFamilyTask.cs trunk/Source/StructureMap.DeploymentTasks/RemoveAssemblyTask.cs trunk/Source/StructureMap.DeploymentTasks/Verification.cs trunk/Source/StructureMap.Testing/Client/ trunk/Source/StructureMap.Testing/Configuration/DiagnosticGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/GraphObjectIteratorTester.cs trunk/Source/StructureMap.Testing/Configuration/InstanceValidatorTester.cs trunk/Source/StructureMap.Testing/Configuration/MockGraphObject.cs trunk/Source/StructureMap.Testing/Configuration/PluginGraphReportTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/ Modified: trunk/Source/StructureMap/Configuration/ConfigurationParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -3,7 +3,6 @@ using System.IO; using System.Xml; using StructureMap.Graph; -using StructureMap.Graph.Configuration; using StructureMap.Source; namespace StructureMap.Configuration Modified: trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -10,9 +10,9 @@ public class ConfigurationParserCollection { private List<FetchNodeDelegate> _fetchers = new List<FetchNodeDelegate>(); + private bool _ignoreDefaultFile = false; private List<string> _otherFiles = new List<string>(); private bool _UseAndEnforceExistenceOfDefaultFile = false; - private bool _ignoreDefaultFile = false; public bool UseAndEnforceExistenceOfDefaultFile { @@ -33,7 +33,7 @@ // Pick up the configuration in the default StructureMap.config string pathToStructureMapConfig = StructureMapConfiguration.GetStructureMapConfigurationPath(); - if ( (_UseAndEnforceExistenceOfDefaultFile || File.Exists(pathToStructureMapConfig)) && !_ignoreDefaultFile) + if ((_UseAndEnforceExistenceOfDefaultFile || File.Exists(pathToStructureMapConfig)) && !_ignoreDefaultFile) { addParsersFromFile(pathToStructureMapConfig, list); } Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -25,10 +25,7 @@ protected override InstanceMemento memento { - get - { - return _memento; - } + get { return _memento; } } protected override InstanceExpression thisInstance Deleted: trunk/Source/StructureMap/Configuration/DiagnosticGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DiagnosticGraphBuilder.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/DiagnosticGraphBuilder.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,287 +0,0 @@ -using System; -using StructureMap.Attributes; -using StructureMap.Configuration.DSL; -using StructureMap.Configuration.Tokens; -using StructureMap.Graph; -using StructureMap.Graph.Configuration; -using StructureMap.Interceptors; - -namespace StructureMap.Configuration -{ - public class DiagnosticGraphBuilder : IGraphBuilder - { - private NormalGraphBuilder _innerBuilder; - private PluginGraphReport _report; - private PluginGraphReport _systemReport; - private InstanceValidator _systemValidator; - - public DiagnosticGraphBuilder(Registry[] registries) - { - _innerBuilder = new NormalGraphBuilder(registries); - _systemReport = new PluginGraphReport(); - _report = new PluginGraphReport(); - } - - public PluginGraphReport Report - { - get { return _report; } - } - - #region IGraphBuilder Members - - public PluginGraph PluginGraph - { - get { return _innerBuilder.PluginGraph; } - } - - public void AddProfile(string profileName) - { - _innerBuilder.AddProfile(profileName); - } - - public void OverrideProfile(string fullTypeName, string instanceKey) - { - _innerBuilder.OverrideProfile(fullTypeName, instanceKey); - } - - public void AddMachine(string machineName, string profileName) - { - try - { - _innerBuilder.AddMachine(machineName, profileName); - } - catch (Exception e) - { - _report.LogProblem(new Problem("Could not add Machine", e)); - } - } - - public void OverrideMachine(string fullTypeName, string instanceKey) - { - _innerBuilder.OverrideMachine(fullTypeName, instanceKey); - } - - public TypePath LocateOrCreateFamilyForType(string fullName) - { - try - { - return _innerBuilder.LocateOrCreateFamilyForType(fullName); - } - catch (Exception e) - { - string message = - string.Format("Could not find the implied type '{0}' in any of the designated Assemblies", fullName); - _report.LogProblem(new Problem(message, e)); - - return null; - } - } - - public void AddAssembly(string assemblyName, string[] deployableTargets) - { - AssemblyToken assemblyToken = new AssemblyToken(assemblyName, deployableTargets); - _report.AddAssembly(assemblyToken); - _systemReport.AddAssembly(assemblyToken); - - try - { - _innerBuilder.AddAssembly(assemblyName, deployableTargets); - } - catch (Exception ex) - { - assemblyToken.MarkLoadFailure(ex); - } - } - - - public void StartFamilies() - { - _innerBuilder.StartFamilies(); - InstanceManager systemInstanceManager = new InstanceManager(_innerBuilder.SystemGraph); - _systemValidator = - new InstanceValidator(_innerBuilder.SystemGraph, new Profile("defaults"), systemInstanceManager); - _systemReport.ImportImplicitChildren(SystemGraph); - } - - public void AddPluginFamily(TypePath typePath, string defaultKey, string[] deploymentTargets, - InstanceScope scope) - { - FamilyToken family = new FamilyToken(typePath, defaultKey, deploymentTargets); - family.DefinitionSource = DefinitionSource.Explicit; - family.Scope = scope; - _report.AddFamily(family); - - try - { - Type type = typePath.FindType(); - _innerBuilder.AddPluginFamily(typePath, defaultKey, deploymentTargets, scope); - } - catch (Exception ex) - { - family.MarkAsInvalidType(ex); - } - } - - - public void AttachSource(TypePath pluginTypePath, InstanceMemento sourceMemento) - { - FamilyToken family = _report.FindFamily(pluginTypePath); - - MementoSourceInstanceToken sourceInstance = - new MementoSourceInstanceToken(typeof (MementoSource), _systemReport, sourceMemento); - family.SourceInstance = sourceInstance; - sourceInstance.Validate(_systemValidator); - - try - { - _innerBuilder.AttachSource(pluginTypePath, sourceMemento); - } - catch (Exception ex) - { - Problem problem = new Problem(ConfigurationConstants.COULD_NOT_CREATE_MEMENTO_SOURCE, ex); - family.LogProblem(problem); - } - } - - public void AttachSource(TypePath pluginTypePath, MementoSource source) - { - _innerBuilder.AttachSource(pluginTypePath, source); - } - - public Plugin AddPlugin(TypePath pluginTypePath, TypePath pluginPath, string concreteKey) - { - PluginToken pluginToken = new PluginToken(pluginPath, concreteKey, DefinitionSource.Explicit); - FamilyToken familyToken = _report.FindFamily(pluginTypePath); - familyToken.AddPlugin(pluginToken); - - Plugin returnValue = null; - - try - { - Plugin plugin = _innerBuilder.AddPlugin(pluginTypePath, pluginPath, concreteKey); - pluginToken.ReadProperties(plugin); - returnValue = plugin; - } - catch (StructureMapException ex) - { - if (ex.ErrorCode == 112) - { - Problem problem = new Problem(ConfigurationConstants.PLUGIN_IS_MISSING_CONCRETE_KEY, ex); - pluginToken.LogProblem(problem); - } - else - { - Problem problem = new Problem(ConfigurationConstants.COULD_NOT_LOAD_TYPE, ex); - pluginToken.LogProblem(problem); - } - } - catch (Exception ex) - { - Problem problem = new Problem(ConfigurationConstants.UNKNOWN_PLUGIN_PROBLEM, ex); - pluginToken.LogProblem(problem); - } - - return returnValue; - } - - public SetterProperty AddSetter(TypePath pluginTypePath, string concreteKey, string setterName) - { - FamilyToken familyToken = _report.FindFamily(pluginTypePath); - PluginToken pluginToken = familyToken.FindPlugin(concreteKey); - - SetterProperty setter = null; - - try - { - setter = _innerBuilder.AddSetter(pluginTypePath, concreteKey, setterName); - PropertyDefinition property = PropertyDefinitionBuilder.CreatePropertyDefinition(setter.Property); - pluginToken.AddPropertyDefinition(property); - } - catch (Exception ex) - { - PropertyDefinition property = - new PropertyDefinition(setterName, PropertyDefinitionType.Setter, ArgumentType.Primitive); - pluginToken.AddPropertyDefinition(property); - Problem problem = new Problem(ConfigurationConstants.INVALID_SETTER, ex); - - property.LogProblem(problem); - } - - return setter; - } - - public void AddInterceptor(TypePath pluginTypePath, InstanceMemento interceptorMemento) - { - InstanceToken instance = - new InterceptorInstanceToken(typeof (InstanceFactoryInterceptor), _systemReport, interceptorMemento); - instance.Validate(_systemValidator); - FamilyToken family = _report.FindFamily(pluginTypePath); - family.AddInterceptor(instance); - - try - { - _innerBuilder.AddInterceptor(pluginTypePath, interceptorMemento); - } - catch (Exception) - { - // no-op; The call above to instance.Validate(_systemValidator) will find the Problem - } - } - - - public void FinishFamilies() - { - _innerBuilder.FinishFamilies(); - } - - public PluginGraph CreatePluginGraph() - { - PluginGraph pluginGraph = _innerBuilder.CreatePluginGraph(); - _report.ImportImplicitChildren(pluginGraph); - _report.AnalyzeInstances(pluginGraph); - - Profile defaultProfile = _innerBuilder.DefaultManager.CalculateDefaults(); - - InstanceManager manager = new InstanceManager(); - try - { - manager = new InstanceManager(pluginGraph); - } - catch (Exception ex) - { - Problem problem = new Problem(ConfigurationConstants.FATAL_ERROR, ex); - _report.LogProblem(problem); - } - - IInstanceValidator validator = new InstanceValidator(pluginGraph, defaultProfile, manager); - _report.ValidateInstances(validator); - - return pluginGraph; - } - - public PluginGraph SystemGraph - { - get { return _innerBuilder.SystemGraph; } - } - - public InstanceDefaultManager DefaultManager - { - get { return _innerBuilder.DefaultManager; } - } - - public void RegisterMemento(TypePath pluginTypePath, InstanceMemento memento) - { - try - { - _innerBuilder.RegisterMemento(pluginTypePath, memento); - } - catch (Exception ex) - { - Problem problem = new Problem(ConfigurationConstants.PLUGIN_FAMILY_CANNOT_BE_FOUND_FOR_INSTANCE, ex); - _report.LogProblem(problem); - } - } - - #endregion - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/FamilyParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/FamilyParser.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/FamilyParser.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -2,7 +2,6 @@ using System.Xml; using StructureMap.Attributes; using StructureMap.Graph; -using StructureMap.Graph.Configuration; using StructureMap.Source; namespace StructureMap.Configuration Deleted: trunk/Source/StructureMap/Configuration/GraphObject.cs =================================================================== --- trunk/Source/StructureMap/Configuration/GraphObject.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/GraphObject.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace StructureMap.Configuration -{ - [Serializable] - public abstract class GraphObject : IComparable - { - private Guid _id = Guid.NewGuid(); - private List<Problem> _problems = new List<Problem>(); - - public GraphObject() - { - } - - public Guid Id - { - get { return _id; } - set { _id = value; } - } - - public Problem[] Problems - { - get { return _problems.ToArray(); } - set { _problems = new List<Problem>(value); } - } - - public virtual GraphObject[] Children - { - get { return new GraphObject[0]; } - } - - protected abstract string key { get; } - - #region IComparable Members - - public int CompareTo(object obj) - { - GraphObject peer = (GraphObject) obj; - return key.CompareTo(peer.key); - } - - #endregion - - public void LogProblem(Problem problem) - { - _problems.Add(problem); - } - - public virtual void AcceptVisitor(IConfigurationVisitor visitor) - { - // no-op - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/GraphObjectIterator.cs =================================================================== --- trunk/Source/StructureMap/Configuration/GraphObjectIterator.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/GraphObjectIterator.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,25 +0,0 @@ -namespace StructureMap.Configuration -{ - public class GraphObjectIterator - { - private readonly IConfigurationVisitor _visitor; - - public GraphObjectIterator(IConfigurationVisitor visitor) - { - _visitor = visitor; - } - - public void Visit(GraphObject startNode) - { - _visitor.StartObject(startNode); - startNode.AcceptVisitor(_visitor); - - foreach (GraphObject child in startNode.Children) - { - Visit(child); - } - - _visitor.EndObject(startNode); - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/IConfigurationVisitor.cs =================================================================== --- trunk/Source/StructureMap/Configuration/IConfigurationVisitor.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/IConfigurationVisitor.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,28 +0,0 @@ -using StructureMap.Configuration.Tokens; -using StructureMap.Configuration.Tokens.Properties; - -namespace StructureMap.Configuration -{ - public interface IConfigurationVisitor - { - void StartObject(GraphObject node); - void EndObject(GraphObject node); - - void HandleAssembly(AssemblyToken assembly); - void HandleFamily(FamilyToken family); - void HandleMementoSource(MementoSourceInstanceToken source); - void HandlePlugin(PluginToken plugin); - void HandleInterceptor(InterceptorInstanceToken interceptor); - void HandleInstance(InstanceToken instance); - void HandlePrimitiveProperty(PrimitiveProperty property); - void HandleEnumerationProperty(EnumerationProperty property); - void HandleInlineChildProperty(ChildProperty property); - void HandleDefaultChildProperty(ChildProperty property); - void HandleReferenceChildProperty(ChildProperty property); - void HandlePropertyDefinition(PropertyDefinition propertyDefinition); - void HandleChildArrayProperty(ChildArrayProperty property); - void HandleNotDefinedChildProperty(ChildProperty property); - void HandleTemplate(TemplateToken template); - void HandleTemplateProperty(TemplateProperty property); - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/IGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/IGraphBuilder.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/IGraphBuilder.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,6 +1,7 @@ using StructureMap.Attributes; +using StructureMap.Graph; -namespace StructureMap.Graph.Configuration +namespace StructureMap.Configuration { public interface IGraphBuilder { @@ -28,6 +29,7 @@ void OverrideProfile(string fullTypeName, string instanceKey); void AddMachine(string machineName, string profileName); void OverrideMachine(string fullTypeName, string instanceKey); + TypePath LocateOrCreateFamilyForType(string fullName); } } \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/IInstanceValidator.cs =================================================================== --- trunk/Source/StructureMap/Configuration/IInstanceValidator.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/IInstanceValidator.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,11 +0,0 @@ -using System; - -namespace StructureMap.Configuration -{ - public interface IInstanceValidator - { - object CreateObject(Type pluginType, InstanceMemento memento); - bool HasDefaultInstance(Type pluginType); - bool InstanceExists(Type pluginType, string instanceKey); - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/InstanceValidator.cs =================================================================== --- trunk/Source/StructureMap/Configuration/InstanceValidator.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/InstanceValidator.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,59 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration -{ - public class InstanceValidator : IInstanceValidator - { - private readonly Profile _defaultProfile; - private readonly PluginGraph _pluginGraph; - private InstanceManager _instanceManager; - - public InstanceValidator(PluginGraph pluginGraph, Profile defaultProfile, InstanceManager instanceManager) - { - if (defaultProfile == null) - { - throw new ArgumentNullException("defaultProfile", "Cannot be null"); - } - - _pluginGraph = pluginGraph; - _defaultProfile = defaultProfile; - _instanceManager = instanceManager; - } - - #region IInstanceValidator Members - - public object CreateObject(Type pluginType, InstanceMemento memento) - { - return _instanceManager.CreateInstance(pluginType, memento); - } - - public bool HasDefaultInstance(Type pluginType) - { - return _defaultProfile.HasOverride(TypePath.GetAssemblyQualifiedName(pluginType)); - } - - public bool InstanceExists(Type pluginType, string instanceKey) - { - bool returnValue = false; - - try - { - PluginFamily family = _pluginGraph.PluginFamilies[pluginType]; - InstanceMemento memento = family.Source.GetMemento(instanceKey); - if (memento != null) - { - returnValue = true; - } - } - catch (Exception) - { - returnValue = false; - } - - return returnValue; - } - - #endregion - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -14,16 +14,6 @@ } - protected override object buildInstance(IInstanceCreator creator) - { - if (_inner == null) - { - _inner = creator.DefaultMemento; - } - - return base.buildInstance(creator); - } - protected override string innerConcreteKey { get { return _inner.ConcreteKey; } @@ -44,6 +34,16 @@ get { return _inner.ReferenceKey; } } + protected override object buildInstance(IInstanceCreator creator) + { + if (_inner == null) + { + _inner = creator.DefaultMemento; + } + + return base.buildInstance(creator); + } + protected override string getPropertyValue(string Key) { return _args.GetArg(Key) ?? _inner.GetProperty(Key); @@ -65,4 +65,4 @@ return _inner.GetChildrenArray(Key); } } -} +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -5,12 +5,12 @@ { public class ExplicitArguments { + private readonly Dictionary<string, string> _args = new Dictionary<string, string>(); private readonly Dictionary<Type, object> _children = new Dictionary<Type, object>(); - private readonly Dictionary<string, string> _args = new Dictionary<string, string>(); public T Get<T>() where T : class { - return (T) Get(typeof(T)); + return (T) Get(typeof (T)); } public object Get(Type type) @@ -20,7 +20,7 @@ public void Set<T>(T arg) { - _children.Add(typeof(T), arg); + _children.Add(typeof (T), arg); } public void SetArg(string key, object argValue) @@ -33,4 +33,4 @@ return _args.ContainsKey(key) ? _args[key] : null; } } -} +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -52,9 +52,9 @@ private readonly Hashtable _children = new Hashtable(); private readonly string _concreteKey; + private readonly NameValueCollection _properties = new NameValueCollection(); private string _instanceKey; private bool _isReference; - private readonly NameValueCollection _properties = new NameValueCollection(); private string _referenceKey; @@ -66,7 +66,6 @@ public MemoryInstanceMemento(string concreteKey, string instanceKey) : this(concreteKey, instanceKey, new NameValueCollection()) { - } Modified: trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -3,7 +3,6 @@ using StructureMap.Attributes; using StructureMap.Configuration.DSL; using StructureMap.Graph; -using StructureMap.Graph.Configuration; using StructureMap.Interceptors; namespace StructureMap.Configuration Deleted: trunk/Source/StructureMap/Configuration/PluginGraphReport.cs =================================================================== --- trunk/Source/StructureMap/Configuration/PluginGraphReport.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/PluginGraphReport.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,215 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using StructureMap.Configuration.Tokens; -using StructureMap.Exceptions; -using StructureMap.Graph; - -namespace StructureMap.Configuration -{ - [Serializable] - public class PluginGraphReport : GraphObject - { - private Hashtable _assemblies = new Hashtable(); - private InstanceDefaultManager _defaultManager; - private Dictionary<TypePath, FamilyToken> _families = new Dictionary<TypePath, FamilyToken>(); - - public PluginGraphReport() - { - } - - public PluginGraphReport(PluginGraph pluginGraph) - { - ReadFromPluginGraph(pluginGraph); - } - - public override GraphObject[] Children - { - get - { - ArrayList list = new ArrayList(); - - list.AddRange(_assemblies.Values); - list.AddRange(_families.Values); - - list.Sort(); - - return (GraphObject[]) list.ToArray(typeof (GraphObject)); - } - } - - public InstanceDefaultManager DefaultManager - { - get { return _defaultManager; } - set { _defaultManager = value; } - } - - public AssemblyToken[] Assemblies - { - get - { - AssemblyToken[] returnValue = new AssemblyToken[_assemblies.Count]; - _assemblies.Values.CopyTo(returnValue, 0); - - return returnValue; - } - } - - public FamilyToken[] Families - { - get - { - FamilyToken[] returnValue = new FamilyToken[_families.Count]; - _families.Values.CopyTo(returnValue, 0); - - - return returnValue; - } - } - - protected override string key - { - get { return string.Empty; } - } - - public void ReadFromPluginGraph(PluginGraph pluginGraph) - { - ImportImplicitChildren(pluginGraph); - AnalyzeInstances(pluginGraph); - - Profile defaultProfile = pluginGraph.DefaultManager.CalculateDefaults(); - - InstanceManager manager = new InstanceManager(); - try - { - manager = new InstanceManager(pluginGraph); - } - catch (Exception ex) - { - Problem problem = new Problem(ConfigurationConstants.FATAL_ERROR, ex); - LogProblem(problem); - } - - IInstanceValidator validator = new InstanceValidator(pluginGraph, defaultProfile, manager); - ValidateInstances(validator); - } - - public void AddAssembly(AssemblyToken assemblyToken) - { - _assemblies.Add(assemblyToken.AssemblyName, assemblyToken); - } - - public void AddFamily(FamilyToken family) - { - _families.Add(family.TypePath, family); - } - - public FamilyToken FindFamily(string pluginTypeClassName) - { - TypePath path = TypePath.GetTypePath(pluginTypeClassName); - if (path != null) - { - return FindFamily(path); - } - - foreach (KeyValuePair<TypePath, FamilyToken> pair in _families) - { - if (pair.Key.Matches(pluginTypeClassName)) - { - return pair.Value; - } - } - - return null; - } - - public bool HasFamily(Type pluginType) - { - return _families.ContainsKey(new TypePath(pluginType)); - } - - public FamilyToken FindFamily(Type pluginType) - { - TypePath path = new TypePath(pluginType); - - if (!_families.ContainsKey(path)) - { - throw new MissingPluginFamilyException(path.AssemblyQualifiedName); - } - - return _families[path]; - } - - - public PluginToken FindPlugin(TypePath pluginTypePath, string concreteKey) - { - return FindFamily(pluginTypePath).FindPlugin(concreteKey); - } - - public PluginToken FindPlugin(Type pluginType, string concreteKey) - { - return FindPlugin(new TypePath(pluginType), concreteKey); - } - - public void ImportImplicitChildren(PluginGraph pluginGraph) - { - foreach (PluginFamily family in pluginGraph.PluginFamilies) - { - if (family.DefinitionSource == DefinitionSource.Implicit) - { - FamilyToken token = FamilyToken.CreateImplicitFamily(family); - AddFamily(token); - } - - addImplicitPlugins(family); - } - } - - private void addImplicitPlugins(PluginFamily family) - { - FamilyToken familyToken = FindFamily(family.PluginType); - - foreach (Plugin plugin in family.Plugins) - { - if (plugin.DefinitionSource == DefinitionSource.Implicit) - { - PluginToken pluginToken = PluginToken.CreateImplicitToken(plugin); - familyToken.AddPlugin(pluginToken); - } - } - } - - public void AnalyzeInstances(PluginGraph pluginGraph) - { - foreach (PluginFamily family in pluginGraph.PluginFamilies) - { - FamilyToken token = FindFamily(family.PluginType); - token.ReadInstances(family, this); - } - } - - public void ValidateInstances(IInstanceValidator validator) - { - foreach (FamilyToken family in _families.Values) - { - family.Validate(validator); - } - } - - public bool HasAssembly(string assemblyName) - { - return _assemblies.ContainsKey(assemblyName); - } - - public TemplateToken FindTemplate(TypePath pluginTypePath, string templateName) - { - FamilyToken family = FindFamily(pluginTypePath); - return family.FindTemplate(templateName); - } - - public FamilyToken FindFamily(TypePath path) - { - return _families[path]; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/ProblemFinder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ProblemFinder.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/ProblemFinder.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,178 +0,0 @@ -using System.Collections; -using StructureMap.Configuration.Tokens; -using StructureMap.Configuration.Tokens.Properties; -using StructureMap.Graph; - -namespace StructureMap.Configuration -{ - public class ProblemFinder : IConfigurationVisitor - { - private readonly PluginGraphReport _report; - private Stack _graphPath = new Stack(); - private ArrayList _problems = new ArrayList(); - - public ProblemFinder(PluginGraphReport report) - { - _report = report; - } - - #region IConfigurationVisitor Members - - public void StartObject(GraphObject node) - { - _graphPath.Push(node.ToString()); - - Problem[] problems = node.Problems; - if (problems.Length > 0) - { - string path = buildPathString(); - foreach (Problem problem in problems) - { - problem.Path = path; - problem.ObjectId = node.Id; - } - - _problems.AddRange(problems); - } - } - - public void EndObject(GraphObject node) - { - _graphPath.Pop(); - } - - public void HandleAssembly(AssemblyToken assembly) - { - // no-op - } - - public void HandleFamily(FamilyToken family) - { - // no-op - } - - public void HandleMementoSource(MementoSourceInstanceToken source) - { - // no-op - } - - public void HandlePlugin(PluginToken plugin) - { - // no-op - } - - public void HandleInterceptor(InterceptorInstanceToken interceptor) - { - // no-op - } - - public void HandleInstance(InstanceToken instance) - { - // no-op - } - - public void HandlePrimitiveProperty(PrimitiveProperty property) - { - // no-op - } - - public void HandleEnumerationProperty(EnumerationProperty property) - { - // no-op - } - - public void HandleInlineChildProperty(ChildProperty property) - { - // no-op - } - - public void HandleDefaultChildProperty(ChildProperty property) - { - // no-op - } - - public void HandleReferenceChildProperty(ChildProperty property) - { - // no-op - } - - public void HandlePropertyDefinition(PropertyDefinition propertyDefinition) - { - // no-op - } - - public void HandleChildArrayProperty(ChildArrayProperty property) - { - // no-op - } - - public void HandleNotDefinedChildProperty(ChildProperty property) - { - // no-op - } - - public void HandleTemplate(TemplateToken template) - { - // no-op - } - - public void HandleTemplateProperty(TemplateProperty property) - { - // no-op - } - - #endregion - - public static Problem[] FindProblems(string configPath) - { - RemoteGraphContainer container = new RemoteGraphContainer(configPath); - RemoteGraph remoteGraph = container.GetRemoteGraph(); - PluginGraphReport report = remoteGraph.GetReport(); - ProblemFinder finder = new ProblemFinder(report); - - return finder.GetProblems(); - } - - public static Problem[] FindProblems(string configPath, string binPath) - { - if (binPath == string.Empty || binPath == null) - { - return FindProblems(configPath); - } - - RemoteGraphContainer container = new RemoteGraphContainer(configPath, binPath); - RemoteGraph remoteGraph = container.GetRemoteGraph(); - PluginGraphReport report = remoteGraph.GetReport(); - ProblemFinder finder = new ProblemFinder(report); - - return finder.GetProblems(); - } - - public static Problem[] FindProblems(PluginGraphReport report) - { - ProblemFinder finder = new ProblemFinder(report); - return finder.GetProblems(); - } - - public Problem[] GetProblems() - { - GraphObjectIterator iterator = new GraphObjectIterator(this); - iterator.Visit(_report); - return (Problem[]) _problems.ToArray(typeof (Problem)); - } - - private string buildPathString() - { - string pad = ""; - string path = ""; - - foreach (object node in _graphPath) - { - path += pad + node + "\n"; - pad += " "; - } - - return path; - } - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/ProfileAndMachineParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ProfileAndMachineParser.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Configuration/ProfileAndMachineParser.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,6 +1,5 @@ using System.Xml; using StructureMap.Graph; -using StructureMap.Graph.Configuration; using StructureMap.Source; namespace StructureMap.Configuration Modified: trunk/Source/StructureMap/Graph/MachineOverride.cs =================================================================== --- trunk/Source/StructureMap/Graph/MachineOverride.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Graph/MachineOverride.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -2,7 +2,6 @@ using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; -using StructureMap.Configuration; namespace StructureMap.Graph { @@ -122,6 +121,5 @@ { return (_defaults.ContainsKey(pluginTypeName) || _profile.HasOverride(pluginTypeName)); } - } } \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/Profile.cs =================================================================== --- trunk/Source/StructureMap/Graph/Profile.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Graph/Profile.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Runtime.CompilerServices; -using StructureMap.Configuration; namespace StructureMap.Graph { Deleted: trunk/Source/StructureMap/Graph/RemoteGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/RemoteGraph.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Graph/RemoteGraph.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,72 +0,0 @@ -using System; -using System.Reflection; -using StructureMap.Configuration; -using StructureMap.DeploymentTasks; - -namespace StructureMap.Graph -{ - /// <summary> - /// Manages the setup and teardown of a new AppDomain to test a StructureMap configuration. - /// </summary> - public class RemoteGraph : MarshalByRefObject - { - private string _binPath; - private string _configPath; - private PluginGraph _pluginGraph; - private PluginGraphReport _report; - - public RemoteGraph() : base() - { - } - - public string ConfigPath - { - get { return _configPath; } - } - - - public void Load(string configPath, string binPath) - { - _configPath = configPath; - _binPath = binPath; - AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); - } - - private void initializeChildren() - { - if (_pluginGraph != null) - { - return; - } - - PluginGraphBuilder builder = new PluginGraphBuilder(_configPath); - _pluginGraph = builder.BuildDiagnosticPluginGraph(); - _report = builder.Report; - } - - - public DeploymentExecutor CreateDeploymentExecutor() - { - return new DeploymentExecutor(); - } - - public PluginGraphReport GetReport() - { - initializeChildren(); - return _report; - } - - public PluginGraph GetPluginGraph() - { - PluginGraphBuilder builder = new PluginGraphBuilder(_configPath); - return builder.Build(); - } - - - private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) - { - string fileName = string.Format("{0}\\{1}.Dll", _binPath, args.Name); - return Assembly.LoadFile(fileName); - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Graph/RemoteGraphContainer.cs =================================================================== --- trunk/Source/StructureMap/Graph/RemoteGraphContainer.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/Graph/RemoteGraphContainer.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,70 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using System.Security.Policy; - -namespace StructureMap.Graph -{ - /// <summary> - /// Manages the setup and teardown of a new AppDomain to test a StructureMap configuration. - /// </summary> - [Serializable] - public class RemoteGraphContainer : MarshalByRefObject - { - private readonly string _assembliesPath; - private readonly string _configPath; - private AppDomain _domain; - - public RemoteGraphContainer(string configPath, string binPath) - { - _configPath = Path.GetFullPath(configPath); - _assembliesPath = Path.GetFullPath(binPath); - } - - public RemoteGraphContainer(string configPath) - { - _configPath = Path.GetFullPath(configPath); - _assembliesPath = Path.GetDirectoryName(_configPath); - } - - - public string BinPath - { - get { return _assembliesPath; } - } - - public string ConfigPath - { - get { return _configPath; } - } - - - public RemoteGraph GetRemoteGraph() - { - AppDomainSetup setup = new AppDomainSetup(); - setup = new AppDomainSetup(); - setup.ApplicationBase = _assembliesPath; - - string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; - string binPath = Path.Combine(baseDirectory, "bin"); - setup.PrivateBinPath = _assembliesPath + ";" + baseDirectory + ";" + binPath; - - - Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence); - string domainName = "StructureMap-" + Guid.NewGuid().ToString(); - _domain = AppDomain.CreateDomain(domainName, evidence, setup); - - - // Got to inject this copy of StructureMap.dll into new domain - string assemblyName = Assembly.GetExecutingAssembly().GetName().Name; - Assembly assem = _domain.Load(assemblyName); - object obj = _domain.CreateInstanceAndUnwrap(assemblyName, typeof (RemoteGraph).FullName); - - RemoteGraph graph = (RemoteGraph) obj; - - graph.Load(_configPath, _assembliesPath); - - return graph; - } - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/IInstanceCreator.cs =================================================================== --- trunk/Source/StructureMap/IInstanceCreator.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/IInstanceCreator.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -2,7 +2,7 @@ { public interface IInstanceCreator { + InstanceMemento DefaultMemento { get; } object BuildInstance(InstanceMemento memento); - InstanceMemento DefaultMemento{ get;} } } \ No newline at end of file Modified: trunk/Source/StructureMap/IPluginGraphSource.cs =================================================================== --- trunk/Source/StructureMap/IPluginGraphSource.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/IPluginGraphSource.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -1,4 +1,3 @@ -using StructureMap.Configuration; using StructureMap.Graph; namespace StructureMap Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -163,6 +163,11 @@ } } + InstanceMemento IInstanceCreator.DefaultMemento + { + get { return _source.DefaultMemento; } + } + #endregion #region IInstanceFactory Members @@ -384,11 +389,5 @@ return memento; } - - - InstanceMemento IInstanceCreator.DefaultMemento - { - get { return _source.DefaultMemento; } - } } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-04-06 16:08:28 UTC (rev 69) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-04-06 16:26:03 UTC (rev 70) @@ -160,14 +160,13 @@ { ExplicitArgumentMemento memento = new ExplicitArgumentMemento(args, null); return CreateInstance<PLUGINTYPE>(memento); - } public void Inject<PLUGINTYPE>(PLUGINTYPE instance) { LiteralMemento memento = new LiteralMemento(instance); AddInstance<PLUGINTYPE>(memento); - SetDefault(typeof(PLUGINTYPE), memento); + SetDefault(typeof (PLUGINTYPE), memento); } public T CreateInstance<T>() @@ -205,6 +204,152 @@ SetDefaults(defaultProfile); } + /// <summary> + /// Creates the named instance of the PluginType + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceKey"></param> + /// <returns></returns> + public object CreateInstance(Type pluginType, string instanceKey) + { + IInstanceFactory instanceFactory = this[pluginType]; + return instanceFactory.GetInstance(instanceKey); + } + + + /// <summary> + /// Creates a new object instance of the requested type + /// </summary> + /// <param name="pluginType"></param> + /// <returns></returns> + public object CreateInstance(Type pluginType) + { + IInstanceFactory instanceFactory = this[pluginType]; + return instanceFactory.GetInstance(); + } + + + /// <summary> + /// Creates a new instance of the requested type using the InstanceMemento. Mostly used from other + /// classes to link children members + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceMemento"></param> + /// <returns></returns> + public object CreateInstance(Type pluginType, InstanceMemento instanceMemento) + { + IInstanceFactory instanceFactory = this[pluginType]; + return instanceFactory.GetInstance(instanceMemento); + } + + /// <summary> + /// Sets the default instance for the PluginType + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceMemento"></param> + public void SetDefault(Type pluginType, InstanceMemento instanceMemento) + { + IInstanceFactory instanceFactory = this[pluginType]; + instanceFactory.SetDefault(instanceMemento); + } + + /// <summary> + /// Sets the default instance for the PluginType + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceKey"></param> + public void SetDefault(Type pluginType, string instanceKey) + { + IInstanceFactory instanceFactory = this[pluginType]; + instanceFactory.SetDefault(instanceKey); + } + + + /// <summary> + /// Sets the default instance for the PluginType + /// </summary> + /// <param name="pluginTypeName"></param> + /// <param name="instanceKey"></param> + public void SetDefault(string pluginTypeName, string instanceKey) + { + IInstanceFactory instanceFactory = this[pluginTypeName]; + instanceFactory.SetDefault(instanceKey); + } + + + /// <summary> + /// Attempts to create a new instance of the requested type. Automatically inserts the default + /// configured instance for each dependency in the StructureMap constructor function. + /// </summary> + /// <param name="type"></param> + /// <returns></returns> + public object FillDependencies(Type type) + { + if (type.IsInterface || type.IsAbstract) + { + throw new StructureMapException(230); + } + + IInstanceFactory factory = getOrCreateFactory(type); + return factory.GetInstance(); + } + + /// <summary> + /// Sets up the InstanceManager to return the object in the "stub" argument anytime + /// any instance of the PluginType is requested + /// </summary> + /// <param name="pluginType"></param> + /// <param name="stub"></param> + public void InjectStub(Type pluginType, object stub) + { + if (!Plugin.CanBeCast(pluginType, stub.GetType())) + { + throw new StructureMapException(220, pluginType.FullName, + stub.GetType().FullName); + } + + LiteralMemento memento = new LiteralMemento(stub); + this[pluginType].SetDefault(memento); + } + + public IList GetAllInstances(Type type) + { + return this[type].GetAllInstances(); + } + + public void AddInstance<T>(InstanceMemento memento) + { + IInstanceFactory factory = getOrCreateFactory(typeof (T), createFactory); + factory.AddInstance(memento); + } + + public void AddInstance<PLUGINTYPE, CONCRETETYPE>() + { + IInstanceFactory factory = getOrCreateFactory(typeof (PLUGINTYPE), createFactory); + InstanceMemento memento = factory.AddType<CONCRETETYPE>(); + factory.AddInstance(memento); + } + + public void AddDefaultInstance<PLUGINTYPE, CONCRETETYPE>() + { + IInstanceFactory factory = getOrCreateFactory(typeof (PLUGINTYPE), createFactory); + InstanceMemento memento = factory.AddType<CONCRETETYPE>(); + factory.SetDefault(memento); + } + + public string WhatDoIHave() + { + StringBuilder sb = new StringBuilder(); + + foreach (IInstanceFactory factory in this) + { + sb.AppendFormat("PluginType {0}, Default: {1}\r\n", factory.PluginType.AssemblyQualifiedName, + factory.DefaultInstanceKey); + } + + return sb.ToString(); + } + #endregion private IInstanceFactory registerPluginFamily(PluginFamily family) @@ -278,33 +423,8 @@ } /// <summary> - /// Creates the named instance of the PluginType - /// </summary> - /// <param name="pluginType"></param> - /// <param name="instanceKey"></param> - /// <returns></returns> - public object CreateInstance(Type pluginType, string instanceKey) - { - IInstanceFactory instanceFactory = this[pluginType]; - return instanceFactory.GetInstance(instanceKey); - } - - - - /// <summary> /// Creates a new object instance of the requested type /// </summary> - /// <param name="pluginType"></param> - /// <returns></returns> - public object CreateInstance(Type pluginType) - { - IInstanceFactory instanceFactory = this[pluginType]; - return instanceFactory.GetInstance(); - } - - /// <summary> - /// Creates a new object instance of the requested type - /// </summary> /// <param name="pluginTypeName">Fully qualified name of the CLR Type to create</param> /// <returns></returns> public object CreateInstance(string pluginTypeName) @@ -326,21 +446,7 @@ return instanceFactory.GetInstance(instanceMemento); } - /// <summary> - /// Creates a new instance of the requested type using the InstanceMemento. Mostly used from other - /// classes to link children members - /// </summary> - /// <param name="pluginType"></param> - /// <param name="instanceMemento"></param> - /// <returns></returns> - public object CreateInstance(Type pluginType, InstanceMemento instanceMemento) - { - IInstanceFactory instanceFactory = this[pluginType]; - return instanceFactory.GetInstance(instanceMemento); - } - - /// <summary> /// Creates an array of object instances of the requested type /// </summary> /// <param name="pluginType"></param> @@ -357,58 +463,6 @@ return instanceFactory.GetArray(instanceMementoes); } - /// <summary> - /// Sets the default instance for the PluginType - /// </summary> - /// <param name="pluginType"></param> - /// <param name="instanceMemento"></param> - public void SetDefault(Type pluginType, InstanceMemento instanceMemento) - { - IInstanceFactory instanceFactory = this[pluginType]; - instanceFactory.SetDefault(instanceMemento); - } - - /// <summary> - /// Sets the default instance for the PluginType - /// </summary> - /// <param name="pluginType"></param> - /// <param name="instanceKey"></param> - public void SetDefault(Type pluginType, string instanceKey) - { - IInstanceFactory instanceFactory = this[pluginType]; - instanceFactory.SetDefault(instanceKey); - } - - - /// <summary> - /// Sets the default instance for the PluginType - /// </summary> - /// <param name="pluginTypeName"></param> - /// <param name="instanceKey"></param> - public void SetDefault(string pluginTypeName, string instanceKey) - { - IInstanceFactory instanceFactory = this[pluginTypeName]; - instanceFactory.SetDefault(instanceKey); - } - - - /// <summary> - /// Attempts to create a new instance of the requested type. Automatically inserts the default - /// configured instance for each dependency in the StructureMap constructor function. - /// </summary> - /// <param name="type"></param> - /// <returns></returns> - public object FillDependencies(Type type) - { - if (type.IsInterface || type.IsAbstract) - { - t... [truncated message content] |
From: <jer...@us...> - 2008-04-06 16:08:31
|
Revision: 69 http://structuremap.svn.sourceforge.net/structuremap/?rev=69&view=rev Author: jeremydmiller Date: 2008-04-06 09:08:28 -0700 (Sun, 06 Apr 2008) Log Message: ----------- getting rid of crap. Killed off the kloogey explorer/diagnostic stuff Modified Paths: -------------- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs trunk/Source/StructureMap/Graph/InstanceDefault.cs trunk/Source/StructureMap/Graph/InstanceDefaultManager.cs trunk/Source/StructureMap/Graph/MachineOverride.cs trunk/Source/StructureMap/Graph/Profile.cs trunk/Source/StructureMap/IPluginGraphSource.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/MementoSource.cs trunk/Source/StructureMap/PluginGraphBuilder.cs trunk/Source/StructureMap/Source/TemplatedMementoSource.cs trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.DeploymentTasks/StructureMap.DeploymentTasks.csproj trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Container/Source/TemplatingTester.cs trunk/Source/StructureMap.Testing/Container/Source/XmlAttributeInstanceMementoTester.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/ObjectMother.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/Source/StructureMap.sln trunk/cruise.build Removed Paths: ------------- trunk/AbstracnessVSInstability.png trunk/ApplicationMetrics.xml trunk/AssembliesBuildOrder.xml trunk/AssembliesDependencies.xml trunk/AssembliesMetrics.xml trunk/ComponentDependenciesDiagram.png trunk/Deploy.build trunk/InfoWarnings.xml trunk/NDependInput.xml trunk/NDependMain.xml trunk/NDependReport.html trunk/RunBuild.BAT trunk/RunMetrics.bat trunk/RunVerficationTesting.BAT trunk/Source/Client/ trunk/Source/StructureMap.Client/ trunk/Source/StructureMap.Testing.DeploymentTasks/ trunk/Source/StructureMap.Testing.PluginGraph/ trunk/Source/StructureMapExplorer/ trunk/StructureMap.build trunk/TypesDependencies.xml trunk/TypesMetrics.xml trunk/verificationTesting.build Deleted: trunk/AbstracnessVSInstability.png =================================================================== (Binary files differ) Deleted: trunk/ApplicationMetrics.xml =================================================================== --- trunk/ApplicationMetrics.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/ApplicationMetrics.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<ApplicationMetrics NAsm="3" NType="191" NClass="164" NAbstractClass="33" NInterface="19" NValueType="8" NExceptionType="3" NAttributeType="5" NDelegateType="2" NEnumType="8" NILInstruction="23437" PercentPublicType="98.95" PercentPublicMethod="71.69" PercentClassWithAtLeastOnePublicField="4.27"> - <PropertyOnInterface Occ="19" Avg="0.95" StdDev="1.5" MaxVal="5" MaxName="Asm:StructureMap Interface:StructureMap.Caching.ICacheItem" /> - <MethodOnInterface Occ="19" Avg="4.32" StdDev="4.66" MaxVal="18" MaxName="Asm:StructureMap Interface:StructureMap.Configuration.IConfigurationVisitor" /> - <ArgOnMethodOnInterface Occ="82" Avg="0.95" StdDev="0.82" MaxVal="4" MaxName="Asm:StructureMap Interface:StructureMap.Graph.Configuration.IGraphBuilder Method:AddPluginFamily" /> - <PublicPropertyOnClass Occ="164" Avg="4.71" StdDev="9.32" MaxVal="109" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell" /> - <PublicMethodOnClass Occ="164" Avg="17.28" StdDev="31.69" MaxVal="403" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell" /> - <ArgOnPublicMethodOnClass Occ="2834" Avg="0.55" StdDev="0.65" MaxVal="5" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell Method:SelectNextControl" /> - <ILInstructionInNonAbstractMethods Occ="1905" Avg="12.31" StdDev="18.76" MaxVal="559" MaxName="Asm:StructureMap.Client Class:StructureMap.Client.Shell.ApplicationShell Method:InitializeComponent()" /> - <TypeWithTheMostILInstruction Occ="162" Avg="144.79" StdDev="123.59" MaxVal="836" MaxName="Asm:StructureMap.Client Type:StructureMap.Client.Shell.ApplicationShell" /> - <MethodCC Occ="1905" Avg="0.53" StdDev="1.32" MaxVal="12" MaxName="Asm:StructureMap Type:StructureMap.Graph.PluginGraph Method:Seal()" /> - <ResponseForType Occ="191" Avg="640.42" StdDev="1054.65" MaxVal="6562" MaxName="Asm:StructureMap Type:StructureMap.Configuration.DiagnosticGraphBuilder" /> -</ApplicationMetrics> \ No newline at end of file Deleted: trunk/AssembliesBuildOrder.xml =================================================================== --- trunk/AssembliesBuildOrder.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/AssembliesBuildOrder.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssemblySortForCompilOrObfusk /> \ No newline at end of file Deleted: trunk/AssembliesDependencies.xml =================================================================== --- trunk/AssembliesDependencies.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/AssembliesDependencies.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssemblyDependencies /> \ No newline at end of file Deleted: trunk/AssembliesMetrics.xml =================================================================== --- trunk/AssembliesMetrics.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/AssembliesMetrics.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<AssembliesMetrics /> \ No newline at end of file Deleted: trunk/ComponentDependenciesDiagram.png =================================================================== (Binary files differ) Deleted: trunk/Deploy.build =================================================================== --- trunk/Deploy.build 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/Deploy.build 2008-04-06 16:08:28 UTC (rev 69) @@ -1,31 +0,0 @@ -<project name="Deploy-StructureMap" default="all"> - <property name="nant.bin.dir" value="D:\work\Dependencies-trunk\external\nant" /> - <property name="structuremap.bin.dir" value="D:\work\Dependencies-trunk\external\StructureMap" /> - - <property name="build.dir" value="build" /> - - - <target name="all" depends="copy, checkin"/> - - <target name="copy"> - <copy file="${build.dir}\StructureMap.dll" todir="${nant.bin.dir}"/> - <copy file="${build.dir}\StructureMap.DeploymentTasks.dll" todir="${nant.bin.dir}"/> - - <copy file="${build.dir}\StructureMap.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMapDoctor.exe" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMapExplorer.exe" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMap.Client.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\StructureMap.DeploymentTasks.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\AxInterop.SHDocVw.dll" todir="${structuremap.bin.dir}"/> - <copy file="${build.dir}\Interop.SHDocVw.dll" todir="${structuremap.bin.dir}"/> - </target> - - <target name="checkin"> - <ifnot test="${property::exists('CCNetLabel')}"> - <property name="CCNetLabel" value="0001" /> - </ifnot> - - <exec program="svn.exe" workingdir="${nant.bin.dir}" commandline="ci --username CruiseControl.net --password SomethingSneaky -m"automatic check-in, cc.net label ${CCNetLabel}"" /> - <exec program="svn.exe" workingdir="${structuremap.bin.dir}" commandline="ci --username CruiseControl.net --password SomethingSneaky -m"automatic check-in, cc.net label ${CCNetLabel}"" /> - </target> -</project> \ No newline at end of file Deleted: trunk/InfoWarnings.xml =================================================================== --- trunk/InfoWarnings.xml 2008-02-28 15:00:17 UTC (rev 68) +++ trunk/InfoWarnings.xml 2008-04-06 16:08:28 UTC (rev 69) @@ -1,1132 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<InfoWarnings> - <Info>INFO: 5/7/2006 8:54:07 AM Retrieve dependencies of your application.</Info> - <Info>INFO: 5/7/2006 8:54:09 AM Analyse dependencies of your application.</Info> - <Info>INFO: No cycle detected.</Info> - <Warning>WARNING: The assembly with simple name {StructureMap.Diagnostics} was not found in specified directories.</Warning> - <Warning>WARNING: The assembly with simple name {log4net} was not found in specified directories.</Warning> - <Warning>WARNING: The assembly with simple name {nunit.framework} was not found in specified directories.</Warning> - <WarningByType TypeName="StructureMap.Configuration.Tokens.AssemblyToken"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.AssemblyToken.MarkLoadFailure(System.Exception)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.Tokens.AssemblyToken..ctor(System.String,System.String[])} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Notify"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Notify} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.Tokens.MementoSourceInstanceToken"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.Tokens.MementoSourceInstanceToken..ctor(System.String,StructureMap.Configuration.PluginGraphReport,StructureMap.InstanceMemento)} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.Parameters.ChildArrayParameterEmitter"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.Parameters.ChildArrayParameterEmitter..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.Parameters.ChildArrayParameterEmitter} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.Parameters.PrimitiveParameterEmitter"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.Parameters.PrimitiveParameterEmitter..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.Parameters.PrimitiveParameterEmitter} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.Tokens.FamilyToken"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.ReadInstances(StructureMap.Graph.PluginFamily,StructureMap.Configuration.PluginGraphReport)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.Validate(StructureMap.Configuration.IInstanceValidator)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.AddInstance(StructureMap.Configuration.Tokens.InstanceToken)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.AddInterceptor(StructureMap.Configuration.Tokens.InstanceToken)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.FindTemplate(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_Templates()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.FindPlugin(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.AddPlugin(StructureMap.Configuration.Tokens.PluginToken)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.MarkTypeCannotBeLoaded(System.Exception)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Configuration.Tokens.FamilyToken.set_SourceInstance(StructureMap.Configuration.Tokens.InstanceToken)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_SourceInstance()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Configuration.Tokens.FamilyToken.set_Scope(StructureMap.Attributes.InstanceScope)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_DefaultKey()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Configuration.Tokens.FamilyToken.set_DefinitionSource(StructureMap.Graph.DefinitionSource)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_DefinitionSource()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_AssemblyName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.CreateImplicitFamily(StructureMap.Graph.PluginFamily)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.Tokens.FamilyToken..ctor(StructureMap.Graph.TypePath,System.String,System.String[])} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Configuration.Tokens.FamilyToken.HasInstance(System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.Tokens.FamilyToken.get_Interceptors()} could have the visibility {private} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.EventDispatcher"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.EventDispatcher..ctor(System.String)} could have the visibility {protected} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.Dispatch()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.RemoveCache(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.AddManagedCache(StructureMap.Caching.IManagedCache)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.EventDispatcher.get_SubjectName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.EventDispatcher.dispatch(StructureMap.Caching.IManagedCache)} could have the visibility {private} instead of the visibility {protected}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Controllers.HTMLSourceFactory"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Client.Controllers.HTMLSourceFactory..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Controllers.HTMLSourceFactory} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.DefinitionSource"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.DefinitionSource} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.Expirations.AbsoluteTimeExpirationPolicy"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.Expirations.AbsoluteTimeExpirationPolicy.get_Ticks()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.Expirations.AbsoluteTimeExpirationPolicy} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.BasicXmlMementoSource"> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Source.BasicXmlMementoSource.set_Family(StructureMap.Graph.PluginFamily)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_Family()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.GetAllMementos()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Source.BasicXmlMementoSource.set_DefaultMemento(StructureMap.InstanceMemento)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_DefaultMemento()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.SetDefault(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.AddExternalMemento(StructureMap.InstanceMemento)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.GetMemento(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.BasicXmlMementoSource.createMemento(System.Xml.XmlNode)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_KeyAttribute()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_TypeAttribute()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Source.BasicXmlMementoSource.get_NodeName()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Source.BasicXmlMementoSource} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.Deployment"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_MachineSpecificOption()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_MachineOption(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_Profile(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_Profile()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_DeploymentTarget()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_DestinationPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_MachineName(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_MachineName()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.Deployment.CreateConfiguration()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_MachineSpecificOption(StructureMap.DeploymentTasks.MachineSpecificOption)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_DestinationPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_ConfigPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_ConfigPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Deployment.get_MachineOption()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Deployment.set_DeploymentTarget(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.Deployment} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.RemoveAssemblyTask"> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.RemoveAssemblyTask.set_AssemblyName(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.RemoveAssemblyTask.get_AssemblyName()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.RemoveAssemblyTask.set_ConfigPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.RemoveAssemblyTask.get_ConfigPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.RemoveAssemblyTask} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.CacheManager"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.CacheManager..ctor(System.Int32)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.CacheManager.get_IsPolling()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheManager.ReleaseCache(System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheManager.WatchFile(System.String,StructureMap.Caching.IManagedCache)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheManager.ManageCache(StructureMap.Caching.IManagedCache)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Caching.CacheManager.get_CurrentManager()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.CacheManager} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.Verification"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Verification.get_BinPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Verification.set_ConfigPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Verification.get_ConfigPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.Verification.set_BinPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.Verification} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.XmlMementoStyle"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Source.XmlMementoStyle} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.XmlMementoSource"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.XmlMementoSource.createMemento(System.Xml.XmlNode)} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Source.XmlMementoSource.getRootNode()} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Source.XmlMementoSource..ctor(System.String,System.String,System.String,StructureMap.Source.XmlMementoStyle)} could have the visibility {protected} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.InstanceValidator"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.InstanceValidator..ctor(StructureMap.Graph.PluginGraph,StructureMap.Graph.Profile,StructureMap.InstanceManager)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Configuration.InstanceValidator} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Verification.PluginGraphConsoleWriter"> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_WriteProblems(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_WriteProblems()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_WriteAll(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_WriteAll()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_IncludeSource(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_IncludeSource()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_IncludeAllInstances(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_IncludeAllInstances()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Verification.PluginGraphConsoleWriter.set_IncludePlugins(System.Boolean)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Verification.PluginGraphConsoleWriter.get_IncludePlugins()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Verification.PluginGraphConsoleWriter.GetReport()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Verification.PluginGraphConsoleWriter.Write(System.IO.TextWriter)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Verification.PluginGraphConsoleWriter} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Source.MemoryMementoSource"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Source.MemoryMementoSource..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Source.MemoryMementoSource} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Interceptors.InstanceFactoryInterceptor"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Interceptors.InstanceFactoryInterceptor..ctor()} could have the visibility {protected} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Exceptions.MissingPluginFamilyException"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Exceptions.MissingPluginFamilyException..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Exceptions.MissingPluginFamilyException} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.Configuration.IGraphBuilder"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.Configuration.IGraphBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.InstanceFactory"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.InstanceFactory..ctor(StructureMap.Graph.PluginFamily,System.Boolean)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.InstanceFactory} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.SerializationStorageStrategy"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.SerializationStorageStrategy} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.PluginGraphObjectCollection"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.PluginGraphObjectCollection..ctor(StructureMap.Graph.PluginGraph)} could have the visibility {protected} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginGraphObjectCollection.get_innerCollection()} could have the visibility {private} instead of the visibility {protected}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.SharedCacheItem"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.SharedCacheItem..ctor(System.Object)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.SharedCacheItem} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.BuildInstanceMethod"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.BuildInstanceMethod..ctor(StructureMap.Graph.Plugin)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.BuildInstanceMethod} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.XmlMapping.ConfigEditor"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.XmlMapping.ConfigEditor..ctor(System.Xml.XmlDocument)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemoveAllMachineOptions()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.FilterToDefaultInstance(System.String,System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.CreateDefaultProfile(StructureMap.Graph.Profile)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemovePlugin(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemovePluginFamily(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.XmlMapping.ConfigEditor.RemoveAssembly(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.XmlMapping.ConfigEditor} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.EagerInstanceCache"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.EagerInstanceCache} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.CacheItem"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheItem.getValue()} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.CacheItem.setValue(System.Object)} could have the visibility {private} instead of the visibility {protected}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.CacheItem..ctor(System.Object)} could have the visibility {protected} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.Versioning.DotNetAssembly"> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.CheckVersion(StructureMap.DeploymentTasks.Versioning.DeployedDirectory,StructureMap.DeploymentTasks.Versioning.IVersionReport)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.TryCreateAssembly(System.IO.FileInfo)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.get_Version()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.Versioning.DotNetAssembly.get_AssemblyName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.DeploymentTasks.Versioning.DotNetAssembly..ctor(System.Reflection.Assembly)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.Versioning.DotNetAssembly} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Interceptors.ThreadLocalStorageInterceptor"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Interceptors.ThreadLocalStorageInterceptor..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Interceptors.ThreadLocalStorageInterceptor} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Views.BasicView"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.BasicView.GetHeaderText(StructureMap.Configuration.GraphObject)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Views.BasicView} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Views.HTMLBuilder"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddDivider()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddTable()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddSubHeader(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Client.Views.HTMLBuilder.get_HTML()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.StartTable()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Views.HTMLBuilder.AddHeader(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Client.Views.HTMLBuilder..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Views.HTMLBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.ObjectFactoryCacheCallback"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.ObjectFactoryCacheCallback..ctor()} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.TypePath"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.TypePath..ctor(System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.TypePath.CanFindType()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.TypePath.FindType()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.TypePath.get_AssemblyName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.TypePath.get_ClassName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.TypePath.CreateFromXmlNode(System.Xml.XmlNode)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.TypePath..ctor(System.String,System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.TypePath} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.MachineOverride"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.MachineOverride.FilterOutNonExistentPluginTypes(StructureMap.Configuration.PluginGraphReport)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.MachineOverride.get_Defaults()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.MachineOverride.get_DefaultKey(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.MachineOverride.HasOverride(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.MachineOverride.AddMachineOverride(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.MachineOverride.get_MachineName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.MachineOverride..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.MachineOverride..ctor(System.String,StructureMap.Graph.Profile)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.MachineOverride} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.DynamicAssembly"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.DynamicAssembly.Compile()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.DynamicAssembly.AddClass(System.String,System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Emitting.DynamicAssembly.get_Name()} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.DynamicAssembly..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.DynamicAssembly} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.DiagnosticGraphBuilder"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Configuration.DiagnosticGraphBuilder..ctor(StructureMap.Graph.InstanceDefaultManager)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Configuration.DiagnosticGraphBuilder.get_Report()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Configuration.DiagnosticGraphBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.RemoteGraph"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.RemoteGraph.Load(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Client.Shell.SearchPart"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Shell.SearchPart.FindNode(StructureMap.Client.TreeNodes.GraphObjectNode)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Client.Shell.SearchPart.ParseParts(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Client.Shell.SearchPart..ctor(System.String,System.String)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Client.Shell.SearchPart} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.DeploymentTasks.ImportFamilyTask"> - <Warning>WARNING: In the context of this application, the method {StructureMap.DeploymentTasks.ImportFamilyTask.ImportFamilyNode(System.Xml.XmlDocument,System.Xml.XmlDocument)} could have the visibility {private} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.ImportFamilyTask.set_PluginType(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.ImportFamilyTask.get_PluginType()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.ImportFamilyTask.set_SourcePath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.ImportFamilyTask.get_SourcePath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.DeploymentTasks.ImportFamilyTask.set_TargetPath(System.String)} is never used.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.DeploymentTasks.ImportFamilyTask.get_TargetPath()} is never used.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.DeploymentTasks.ImportFamilyTask} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.MockInstanceFactory"> - <Warning>WARNING: In the context of this application, the method {StructureMap.MockInstanceFactory.GetMock()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.MockInstanceFactory..ctor(StructureMap.IInstanceFactory)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.MockInstanceFactory} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.InstanceDefault"> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.InstanceDefault..ctor(System.String,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.InstanceDefault.get_DefaultKey()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.InstanceDefault.get_PluginTypeName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Graph.InstanceDefault} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.ICacheItem"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.ICacheItem} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Emitting.ClassBuilder"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.ClassBuilder.AddReadonlyStringProperty(System.String,System.String,System.Boolean)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Emitting.ClassBuilder.get_ClassName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Emitting.ClassBuilder.AddMethod(StructureMap.Emitting.Method)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.ClassBuilder..ctor(System.Reflection.Emit.ModuleBuilder,System.String,System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Emitting.ClassBuilder..ctor(System.Reflection.Emit.ModuleBuilder,System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Emitting.ClassBuilder} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Configuration.Tokens.ArgumentType"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Configuration.Tokens.ArgumentType} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.FileModificationWatcher"> - <Warning>WARNING: In the context of this application, the method {StructureMap.Caching.FileModificationWatcher.SubjectNameFromFilePath(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Caching.FileModificationWatcher..ctor(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.FileModificationWatcher} could have the visibility {internal} instead of the visibility {public}.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Caching.CloneStorageStrategy"> - <Warning>WARNING: In the context of this application, the type {StructureMap.Caching.CloneStorageStrategy} is never used.</Warning> - </WarningByType> - <WarningByType TypeName="StructureMap.Graph.PluginFamily"> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_PluginTypeName()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.PluginFamily.SearchAssemblyGraph(StructureMap.Graph.AssemblyGraph)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_DefinitionSource(StructureMap.Graph.DefinitionSource)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_DefaultInstanceKey()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_PluginType()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.PluginFamily.CreateAutoFilledPluginFamily(System.Type)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the method {StructureMap.Graph.PluginFamily.RemoveImplicitChildren()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_Plugins()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_InterceptionChain(StructureMap.Graph.InterceptionChain)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_InterceptionChain()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_Source(StructureMap.MementoSource)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_Source()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property getter {StructureMap.Graph.PluginFamily.get_DefinitionSource()} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the property setter {StructureMap.Graph.PluginFamily.set_DefaultInstanceKey(System.String)} could have the visibility {internal} instead of the visibility {public}.</Warning> - <Warning>WARNING: In the context of this application, the constructor {StructureMap.Graph.PluginFamily..ctor(StructureMap.Graph.TypePath,System.String)} could have the visibility {internal} instead of the visibi... [truncated message content] |
From: <jer...@us...> - 2008-02-28 15:00:21
|
Revision: 68 http://structuremap.svn.sourceforge.net/structuremap/?rev=68&view=rev Author: jeremydmiller Date: 2008-02-28 07:00:17 -0800 (Thu, 28 Feb 2008) Log Message: ----------- Fixing the bug with AddInstanceOf<Blah>() creating two instances in the call to GetAllInstances() Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs trunk/Source/StructureMap/Graph/PluginCollection.cs trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/IInstanceManager.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -97,7 +97,7 @@ _alterations.Add(delegate(PluginFamily family) { - Plugin plugin = family.Plugins.FindOrCreate(typeof (CONCRETETYPE)); + Plugin plugin = family.Plugins.FindOrCreate(typeof (CONCRETETYPE), true); family.DefaultInstanceKey = plugin.ConcreteKey; }); @@ -161,7 +161,7 @@ { Plugin plugin = Plugin.CreateImplicitPlugin(typeof (CONCRETETYPE)); plugin.ConcreteKey = instanceName; - family.Plugins.Add(plugin); + family.Plugins.Add(plugin, true); } ); Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -25,7 +25,10 @@ protected override InstanceMemento memento { - get { return _memento; } + get + { + return _memento; + } } protected override InstanceExpression thisInstance @@ -42,7 +45,7 @@ { Plugin plugin = _pluggedType == null ? family.Plugins[_memento.ConcreteKey] - : family.Plugins.FindOrCreate(_pluggedType); + : family.Plugins.FindOrCreate(_pluggedType, false); _memento.ConcreteKey = plugin.ConcreteKey; } @@ -176,6 +179,7 @@ public InstanceExpression UsingConcreteType<T>() { _parent._pluggedType = typeof (T); + _parent._memento.InstanceKey = typeof (T).Name; return _parent; } Modified: trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -159,7 +159,7 @@ Plugin plugin = new Plugin(pluginPath, concreteKey); plugin.DefinitionSource = DefinitionSource.Explicit; - family.Plugins.Add(plugin); + family.Plugins.Add(plugin, true); return plugin; } @@ -200,7 +200,7 @@ Plugin inferredPlugin = memento.CreateInferredPlugin(); if (inferredPlugin != null) { - family.Plugins.Add(inferredPlugin); + family.Plugins.Add(inferredPlugin, true); } family.Source.AddExternalMemento(memento); Modified: trunk/Source/StructureMap/Graph/PluginCollection.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginCollection.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/Graph/PluginCollection.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -93,7 +93,7 @@ public void Add(TypePath path, string concreteKey) { Plugin plugin = new Plugin(path, concreteKey); - Add(plugin); + Add(plugin, true); } /// <summary> @@ -105,10 +105,10 @@ public void Add(Type pluggedType, string concreteKey) { Plugin plugin = Plugin.CreateExplicitPlugin(pluggedType, concreteKey, string.Empty); - Add(plugin); + Add(plugin, true); } - public void Add(Plugin plugin) + public void Add(Plugin plugin, bool addInstanceOfTypeIfPossible) { // Reject if a duplicate ConcreteKey if (_plugins.ContainsKey(plugin.ConcreteKey)) @@ -129,10 +129,12 @@ throw new StructureMapException(114, plugin.PluggedType.FullName, _family.PluginTypeName); } - plugin.AddToSource(_family.Source); + _plugins.Add(plugin.ConcreteKey, plugin); - - _plugins.Add(plugin.ConcreteKey, plugin); + if (addInstanceOfTypeIfPossible) + { + plugin.AddToSource(_family.Source); + } } /// <summary> @@ -162,10 +164,10 @@ } } - public Plugin FindOrCreate(Type pluggedType) + public Plugin FindOrCreate(Type pluggedType, bool createDefaultInstanceOfType) { Plugin plugin = Plugin.CreateImplicitPlugin(pluggedType); - Add(plugin); + Add(plugin, createDefaultInstanceOfType); return plugin; } Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -20,7 +20,7 @@ PluginFamily family = new PluginFamily(pluginType); family.DefinitionSource = DefinitionSource.Implicit; - family.Plugins.Add(plugin); + family.Plugins.Add(plugin, true); family.DefaultInstanceKey = plugin.ConcreteKey; return family; @@ -135,7 +135,7 @@ if (isOfCorrectGenericType(plugin, templateTypes)) { Plugin templatedPlugin = plugin.CreateTemplatedClone(templateTypes); - templatedFamily.Plugins.Add(templatedPlugin); + templatedFamily.Plugins.Add(templatedPlugin, true); foreach (InstanceMemento memento in _source.GetAllMementos()) { if (memento.ConcreteKey == plugin.ConcreteKey) @@ -196,7 +196,7 @@ foreach (Plugin plugin in plugins) { - _plugins.Add(plugin); + _plugins.Add(plugin, true); } return plugins; Modified: trunk/Source/StructureMap/IInstanceManager.cs =================================================================== --- trunk/Source/StructureMap/IInstanceManager.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/IInstanceManager.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -80,5 +80,6 @@ object CreateInstance(Type pluginType, string instanceKey); PLUGINTYPE CreateInstance<PLUGINTYPE>(ExplicitArguments args); + void Inject<PLUGINTYPE>(PLUGINTYPE instance); } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -163,6 +163,13 @@ } + public void Inject<PLUGINTYPE>(PLUGINTYPE instance) + { + LiteralMemento memento = new LiteralMemento(instance); + AddInstance<PLUGINTYPE>(memento); + SetDefault(typeof(PLUGINTYPE), memento); + } + public T CreateInstance<T>() { return (T) CreateInstance(typeof (T)); Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap/ObjectFactory.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -88,9 +88,7 @@ /// <param name="instance"></param> public static void Inject<PLUGINTYPE>(PLUGINTYPE instance) { - LiteralMemento memento = new LiteralMemento(instance); - manager.AddInstance<PLUGINTYPE>(memento); - manager.SetDefault(typeof (PLUGINTYPE), memento); + manager.Inject<PLUGINTYPE>(instance); } /// <summary> Modified: trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -77,7 +77,7 @@ // Set the auto mocking container to use a Stub for Type T public void InjectStub<T>(T stub) { - _manager.InjectStub<T>(stub); + _manager.Inject<T>(stub); } // So that Aaron Jensen can use his concrete HubService object Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using NUnit.Framework; using StructureMap.Attributes; using StructureMap.Configuration.DSL; @@ -174,6 +175,39 @@ Assert.IsInstanceOfType(typeof (DefaultGateway), gateway); } + + [Test] + public void AddInstanceByNameOnlyAddsOneInstanceToStructureMap() + { + Registry registry = new Registry(); + registry.ForRequestedType<Something>().AddInstance( + Registry.Instance<Something>().UsingConcreteType<RedSomething>().WithName("Red") + ); + + IInstanceManager manager = registry.BuildInstanceManager(); + IList<Something> instances = manager.GetAllInstances<Something>(); + Assert.AreEqual(1, instances.Count); + } + + [Test] + public void AddInstanceWithNameOnlyAddsOneInstanceToStructureMap() + { + PluginGraph graph = new PluginGraph(); + Registry registry = new Registry(graph); + registry.AddInstanceOf<Something>().UsingConcreteType<RedSomething>().WithName("Red"); + + + + IInstanceManager manager = registry.BuildInstanceManager(); + IList<Something> instances = manager.GetAllInstances<Something>(); + Assert.AreEqual(1, instances.Count); + } + + public class Something{} + + public class RedSomething : Something{} + public class GreenSomething : Something{} + } public class StubbedInstanceFactoryInterceptor : InstanceFactoryInterceptor Modified: trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs 2008-02-14 15:31:38 UTC (rev 67) +++ trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs 2008-02-28 15:00:17 UTC (rev 68) @@ -54,7 +54,7 @@ { PluginFamily family = new PluginFamily(typeof (IGridColumn)); Plugin plugin = Plugin.CreateImplicitPlugin(typeof (EnumGridColumn)); - family.Plugins.Add(plugin); + family.Plugins.Add(plugin, true); InstanceFactory factory = new InstanceFactory(family, true); InstanceMemento memento = _source.GetMemento("Enum"); @@ -69,7 +69,7 @@ { PluginFamily family = new PluginFamily(typeof (IGridColumn)); Plugin plugin = Plugin.CreateImplicitPlugin(typeof (LongGridColumn)); - family.Plugins.Add(plugin); + family.Plugins.Add(plugin, true); InstanceFactory factory = new InstanceFactory(family, true); InstanceMemento memento = _source.GetMemento("Long"); @@ -86,7 +86,7 @@ { PluginFamily family = new PluginFamily(typeof (IGridColumn)); Plugin plugin = Plugin.CreateImplicitPlugin(typeof (StringGridColumn)); - family.Plugins.Add(plugin); + family.Plugins.Add(plugin, true); InstanceFactory factory = new InstanceFactory(family, true); InstanceMemento memento = _source.GetMemento("String"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <us...@us...> - 2008-02-14 15:31:40
|
Revision: 67 http://structuremap.svn.sourceforge.net/structuremap/?rev=67&view=rev Author: ussherm Date: 2008-02-14 07:31:38 -0800 (Thu, 14 Feb 2008) Log Message: ----------- More documentation cleanup Modified Paths: -------------- trunk/Source/StructureMap/ObjectFactory.cs Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2008-02-14 14:54:17 UTC (rev 66) +++ trunk/Source/StructureMap/ObjectFactory.cs 2008-02-14 15:31:38 UTC (rev 67) @@ -2,7 +2,6 @@ using System.Collections; using System.Collections.Generic; using System.Security.Permissions; -using System.Text; using StructureMap.Configuration.Mementos; using StructureMap.Graph; @@ -110,7 +109,7 @@ /// Injects a new instance of CONCRETETYPE to PLUGINTYPE by name. /// </summary> /// <typeparam name="PLUGINTYPE"></typeparam> - /// <param name="instance"></param> + /// <typeparam name="CONCRETETYPE"></typeparam> /// <param name="instanceKey"></param> public static void InjectByName<PLUGINTYPE, CONCRETETYPE>(string instanceKey) { @@ -232,7 +231,7 @@ } else { - throw ex; + throw; } } } @@ -265,7 +264,7 @@ /// <summary> /// Returns the default instance of the requested System.Type /// </summary> - /// <param name="TargetType"></param> + /// <typeparam name="TargetType"></typeparam> /// <returns></returns> public static TargetType GetInstance<TargetType>() { @@ -286,7 +285,7 @@ /// <summary> /// Builds an instance of the TargetType for the given InstanceMemento /// </summary> - /// <param name="TargetType"></param> + /// <typeparam name="TargetType"></typeparam> /// <param name="memento"></param> /// <returns></returns> public static TargetType GetInstance<TargetType>(InstanceMemento memento) @@ -308,7 +307,7 @@ /// <summary> /// Returns the named instance of the requested System.Type /// </summary> - /// <param name="TargetType"></param> + /// <typeparam name="TargetType"></typeparam> /// <param name="InstanceName"></param> /// <returns></returns> public static TargetType GetNamedInstance<TargetType>(string InstanceName) @@ -329,7 +328,7 @@ /// <summary> /// Sets the default instance of the TargetType /// </summary> - /// <param name="TargetType"></param> + /// <typeparam name="TargetType"></typeparam> /// <param name="InstanceName"></param> public static void SetDefaultInstanceName<TargetType>(string InstanceName) { @@ -360,7 +359,7 @@ /// <summary> /// Retrieves a list of all of the configured instances for a particular type /// </summary> - /// <param name="targetType"></param> + /// <typeparam name="TargetType"></typeparam> /// <returns></returns> public static IList<TargetType> GetAllInstances<TargetType>() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <us...@us...> - 2008-02-14 14:54:20
|
Revision: 66 http://structuremap.svn.sourceforge.net/structuremap/?rev=66&view=rev Author: ussherm Date: 2008-02-14 06:54:17 -0800 (Thu, 14 Feb 2008) Log Message: ----------- Fixing a small documentation issue that was causing the .xml docs to not be generated. Modified Paths: -------------- trunk/Source/StructureMap/ObjectFactory.cs Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2008-02-14 04:10:06 UTC (rev 65) +++ trunk/Source/StructureMap/ObjectFactory.cs 2008-02-14 14:54:17 UTC (rev 66) @@ -132,7 +132,7 @@ /// <summary> /// Adds a new CONCRETETYPE to StructureMap so that an instance of CONCRETETYPE - /// will be returned from a call to ObjectFactory.GetAllInstances<PLUGINTYPE>() + /// will be returned from a call to ObjectFactory.GetAllInstance<PLUGINTYPE>() /// </summary> /// <typeparam name="PLUGINTYPE"></typeparam> /// <typeparam name="CONCRETETYPE"></typeparam> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <us...@us...> - 2008-02-14 04:10:09
|
Revision: 65 http://structuremap.svn.sourceforge.net/structuremap/?rev=65&view=rev Author: ussherm Date: 2008-02-13 20:10:06 -0800 (Wed, 13 Feb 2008) Log Message: ----------- - Generating strongly-named assemblies (StructureMap and StructureMap.AutoMocking) - Also adding a few SVN ignore attributes. :) Modified Paths: -------------- trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj trunk/Source/StructureMap.sln Added Paths: ----------- trunk/Source/StructureMap/Properties/ trunk/Source/StructureMap/Properties/AssemblyInfo.cs trunk/Source/structuremap.snk Removed Paths: ------------- trunk/Source/StructureMap/AssemblyInfo.cs Property Changed: ---------------- trunk/Source/StructureMap.AutoMocking/ trunk/Source/StructureMap.DataAccess/ trunk/Source/StructureMap.Testing.GenericWidgets/ Deleted: trunk/Source/StructureMap/AssemblyInfo.cs =================================================================== --- trunk/Source/StructureMap/AssemblyInfo.cs 2008-02-12 15:23:15 UTC (rev 64) +++ trunk/Source/StructureMap/AssemblyInfo.cs 2008-02-14 04:10:06 UTC (rev 65) @@ -1,12 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// - -[assembly : AssemblyTitle("StructureMap")] -[assembly : AssemblyDescription("Main Library")] -[assembly : InternalsVisibleTo("StructureMap.AutoMocking")] \ No newline at end of file Copied: trunk/Source/StructureMap/Properties/AssemblyInfo.cs (from rev 64, trunk/Source/StructureMap/AssemblyInfo.cs) =================================================================== --- trunk/Source/StructureMap/Properties/AssemblyInfo.cs (rev 0) +++ trunk/Source/StructureMap/Properties/AssemblyInfo.cs 2008-02-14 04:10:06 UTC (rev 65) @@ -0,0 +1,12 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// + +[assembly: AssemblyTitle("StructureMap")] +[assembly: AssemblyDescription("Main Library")] +[assembly: InternalsVisibleTo("StructureMap.AutoMocking, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d9a2a76e43cd9b1b1944b1f3b489a046b33f0bcd755b25cc5d3ed7b18ded38240d6db7578cd986c72d3feb4f94a7ab26fcfa41e3e4f41cf2c029fba91159db05c44d63f0b2bfac24353a07f4a1230dd3d4240340adafa2275277fa083c75958062cd0e60016701db6af7ae718efdf1e802a840595b49c290964255b3c60c494")] \ No newline at end of file Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-02-12 15:23:15 UTC (rev 64) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-02-14 04:10:06 UTC (rev 65) @@ -11,8 +11,7 @@ <AssemblyKeyContainerName> </AssemblyKeyContainerName> <AssemblyName>StructureMap</AssemblyName> - <AssemblyOriginatorKeyFile> - </AssemblyOriginatorKeyFile> + <AssemblyOriginatorKeyFile>..\structuremap.snk</AssemblyOriginatorKeyFile> <DefaultClientScript>JScript</DefaultClientScript> <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> <DefaultTargetSchema>IE50</DefaultTargetSchema> @@ -26,6 +25,7 @@ </FileUpgradeFlags> <UpgradeBackupLocation> </UpgradeBackupLocation> + <SignAssembly>true</SignAssembly> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <OutputPath>bin\Debug\</OutputPath> @@ -115,7 +115,7 @@ <Link>CommonAssemblyInfo.cs</Link> <SubType>Code</SubType> </Compile> - <Compile Include="AssemblyInfo.cs"> + <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Attributes\DefaultConstructorAttribute.cs"> @@ -575,6 +575,11 @@ <SubType>Designer</SubType> </EmbeddedResource> </ItemGroup> + <ItemGroup> + <None Include="..\structuremap.snk"> + <Link>Properties\structuremap.snk</Link> + </None> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <PropertyGroup> <PreBuildEvent> Property changes on: trunk/Source/StructureMap.AutoMocking ___________________________________________________________________ Name: svn:ignore + bin obj Modified: trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj =================================================================== --- trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2008-02-12 15:23:15 UTC (rev 64) +++ trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2008-02-14 04:10:06 UTC (rev 65) @@ -9,6 +9,8 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>StructureMap.AutoMocking</RootNamespace> <AssemblyName>StructureMap.AutoMocking</AssemblyName> + <SignAssembly>true</SignAssembly> + <AssemblyOriginatorKeyFile>..\structuremap.snk</AssemblyOriginatorKeyFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -53,6 +55,11 @@ <Name>StructureMap</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <None Include="..\structuremap.snk"> + <Link>Properties\structuremap.snk</Link> + </None> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Property changes on: trunk/Source/StructureMap.DataAccess ___________________________________________________________________ Name: svn:ignore - bin obj + bin obj StructureMap.DataAccess.ndoc.xml Property changes on: trunk/Source/StructureMap.Testing.GenericWidgets ___________________________________________________________________ Name: svn:ignore - obj + obj bin Modified: trunk/Source/StructureMap.sln =================================================================== --- trunk/Source/StructureMap.sln 2008-02-12 15:23:15 UTC (rev 64) +++ trunk/Source/StructureMap.sln 2008-02-14 04:10:06 UTC (rev 65) @@ -1,30 +1,82 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap", "StructureMap\StructureMap.csproj", "{3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Diagnostics", "StructureMap.Diagnostics\StructureMap.Diagnostics.csproj", "{52CDE969-625F-4FB6-8EC5-CD297FD809CA}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing", "StructureMap.Testing\StructureMap.Testing.csproj", "{63C2742D-B6E2-484F-AFDB-346873075C5E}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing.Widget", "StructureMap.Testing.Widget\StructureMap.Testing.Widget.csproj", "{E21E1651-3E32-47B7-A290-F461E63FEAD2}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing.Widget2", "StructureMap.Testing.Widget2\StructureMap.Testing.Widget2.csproj", "{027E996C-75E8-40F8-9073-0E3B77A6BE1F}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing.Widget3", "StructureMap.Testing.Widget3\StructureMap.Testing.Widget3.csproj", "{C8878328-281F-4F4F-8D6E-88C60F304B89}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing.Widget4", "StructureMap.Testing.Widget4\StructureMap.Testing.Widget4.csproj", "{901D15CB-EF37-4F84-864B-E70F4B5F1DFF}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing.Widget5", "StructureMap.Testing.Widget5\StructureMap.Testing.Widget5.csproj", "{CAB97F7F-FB75-410C-898A-88DCAAC036BE}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.DeploymentTasks", "StructureMap.DeploymentTasks\StructureMap.DeploymentTasks.csproj", "{DB6A0B91-873E-4E04-866A-7483E136A8D4}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing.DeploymentTasks", "StructureMap.Testing.DeploymentTasks\StructureMap.Testing.DeploymentTasks.csproj", "{195EB3B0-96D2-4047-B091-E858690C741C}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Client", "StructureMap.Client\StructureMap.Client.csproj", "{887C4441-07A4-489D-B8D9-EFE9D28A47CA}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMapExplorer", "StructureMapExplorer\StructureMapExplorer.csproj", "{51039D04-6DB6-44BD-B827-39C86482D9F0}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{93877CE0-BA48-4F28-B372-B8E802CEE085}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection ProjectSection(SolutionItems) = preProject ..\Docs\Basic Architecture.htm = ..\Docs\Basic Architecture.htm CommonAssemblyInfo.cs = CommonAssemblyInfo.cs @@ -38,6 +90,7 @@ ..\Docs\SingletonInjection.htm = ..\Docs\SingletonInjection.htm ..\Docs\structuremap.deployment.htm = ..\Docs\structuremap.deployment.htm StructureMap.ndoc = StructureMap.ndoc + structuremap.snk = structuremap.snk ..\Docs\structuremap.verification.htm = ..\Docs\structuremap.verification.htm ..\Docs\StructureMap.vsd = ..\Docs\StructureMap.vsd ..\Docs\StructureMapDoctor.htm = ..\Docs\StructureMapDoctor.htm @@ -47,14 +100,34 @@ EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.Testing.GenericWidgets", "StructureMap.Testing.GenericWidgets\StructureMap.Testing.GenericWidgets.csproj", "{C205EA4C-4CD0-4221-A3CB-AFD835F0B263}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.DataAccess", "StructureMap.DataAccess\StructureMap.DataAccess.csproj", "{DB798C07-0C82-4298-8BAA-D702CF96C28E}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Widgets", "Widgets", "{E1C10209-160D-4054-ACB7-478A9FDCF84C}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUI", "GUI", "{4F638ECF-2A69-4D6A-9B68-05CC40951217}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructureMap.AutoMocking", "StructureMap.AutoMocking\StructureMap.AutoMocking.csproj", "{0ED1B206-A1C9-4A52-BA87-3BA416C8725C}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Added: trunk/Source/structuremap.snk =================================================================== (Binary files differ) Property changes on: trunk/Source/structuremap.snk ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-02-12 15:23:19
|
Revision: 64 http://structuremap.svn.sourceforge.net/structuremap/?rev=64&view=rev Author: jeremydmiller Date: 2008-02-12 07:23:15 -0800 (Tue, 12 Feb 2008) Log Message: ----------- using DynamicMocks by default in the AutoMocking Modified Paths: -------------- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs Modified: trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-02-09 16:10:55 UTC (rev 63) +++ trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-02-12 15:23:15 UTC (rev 64) @@ -79,6 +79,15 @@ { _manager.InjectStub<T>(stub); } + + // So that Aaron Jensen can use his concrete HubService object + // Construct whatever T is with all mocks, and make sure that the + // ClassUnderTest gets built with a concrete T + public void UseConcreteClassFor<T>() + { + T concreteClass = _manager.FillDependencies<T>(); + _manager.InjectStub(concreteClass); + } } Modified: trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs 2008-02-09 16:10:55 UTC (rev 63) +++ trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs 2008-02-12 15:23:15 UTC (rev 64) @@ -21,12 +21,12 @@ public T Service<T>() { - return _mocks.CreateMock<T>(); + return _mocks.DynamicMock<T>(); } public object Service(Type serviceType) { - return _mocks.CreateMock(serviceType); + return _mocks.DynamicMock(serviceType); } #endregion Modified: trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2008-02-09 16:10:55 UTC (rev 63) +++ trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2008-02-12 15:23:15 UTC (rev 64) @@ -26,6 +26,30 @@ private AutoMockedInstanceManager _instanceManager; + public class ConcreteThing + { + private readonly IMockedService _service; + private readonly IMockedService2 _service2; + + + public ConcreteThing(IMockedService service, IMockedService2 service2) + { + _service = service; + _service2 = service2; + } + + + public IMockedService Service + { + get { return _service; } + } + + public IMockedService2 Service2 + { + get { return _service2; } + } + } + public class ConcreteClass { private readonly IMockedService _service; @@ -106,6 +130,19 @@ } [Test] + public void UseConcreteClassFor() + { + RhinoAutoMocker<ConcreteClass> mocker = new RhinoAutoMocker<ConcreteClass>(); + mocker.UseConcreteClassFor<ConcreteThing>(); + + ConcreteThing thing = mocker.Get<ConcreteThing>(); + Assert.IsInstanceOfType(typeof(ConcreteThing), thing); + + Assert.AreSame(mocker.Get<IMockedService>(), thing.Service); + Assert.AreSame(mocker.Get<IMockedService2>(), thing.Service2); + } + + [Test] public void AutoFillAConcreteClassWithMocks() { IMockedService service = _instanceManager.CreateInstance<IMockedService>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-02-09 16:11:00
|
Revision: 63 http://structuremap.svn.sourceforge.net/structuremap/?rev=63&view=rev Author: jeremydmiller Date: 2008-02-09 08:10:55 -0800 (Sat, 09 Feb 2008) Log Message: ----------- spiffing up the automocking container stuff Modified Paths: -------------- trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs trunk/Source/StructureMap/Graph/PluginGraph.cs trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs Modified: trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-01-29 02:02:34 UTC (rev 62) +++ trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs 2008-02-09 16:10:55 UTC (rev 63) @@ -32,7 +32,7 @@ registry.ConfigurePluginGraph(_pluginGraph); } - _systemGraph = new PluginGraph(); + _systemGraph = new PluginGraph(false); _systemGraph.Assemblies.Add(Assembly.GetExecutingAssembly()); } Modified: trunk/Source/StructureMap/Graph/PluginGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginGraph.cs 2008-01-29 02:02:34 UTC (rev 62) +++ trunk/Source/StructureMap/Graph/PluginGraph.cs 2008-02-09 16:10:55 UTC (rev 63) @@ -20,8 +20,8 @@ private readonly InterceptorLibrary _interceptorLibrary = new InterceptorLibrary(); private readonly PluginFamilyCollection _pluginFamilies; private bool _sealed = false; + private bool _useExternalRegistries = true; - /// <summary> /// Default constructor /// </summary> @@ -32,6 +32,11 @@ } + public PluginGraph(bool useExternalRegistries) : this() + { + _useExternalRegistries = useExternalRegistries; + } + public AssemblyGraphCollection Assemblies { get { return _assemblies; } @@ -70,7 +75,10 @@ return; } - searchAssembliesForRegistries(); + if (_useExternalRegistries) + { + searchAssembliesForRegistries(); + } foreach (AssemblyGraph assembly in _assemblies) { Modified: trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs 2008-01-29 02:02:34 UTC (rev 62) +++ trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs 2008-02-09 16:10:55 UTC (rev 63) @@ -1,4 +1,5 @@ using System; +using StructureMap.Graph; namespace StructureMap.AutoMocking { Modified: trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-01-29 02:02:34 UTC (rev 62) +++ trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-02-09 16:10:55 UTC (rev 63) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Reflection; using Rhino.Mocks; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.AutoMocking @@ -10,10 +11,11 @@ public delegate void VoidMethod(); - + // Note that it subclasses the RhinoMocks.MockRepository class public class RhinoAutoMocker<TARGETCLASS> : MockRepository where TARGETCLASS : class { private readonly AutoMockedInstanceManager _manager; + private TARGETCLASS _classUnderTest; public RhinoAutoMocker() { @@ -21,19 +23,34 @@ _manager = new AutoMockedInstanceManager(locator); } + // Replaces the inner InstanceManager in ObjectFactory with the mocked + // InstanceManager from the auto mocking container. This will make ObjectFactory + // return mocks for everything. Use cautiously!!!!!!!!!!!!!!! public void MockObjectFactory() { ObjectFactory.ReplaceManager(_manager); } - public TARGETCLASS Create() + // Gets the ClassUnderTest with mock objects (or stubs) pushed in + // for all of its dependencies + public TARGETCLASS ClassUnderTest { - return _manager.FillDependencies<TARGETCLASS>(); + get + { + if (_classUnderTest == null) + { + _classUnderTest = _manager.FillDependencies<TARGETCLASS>(); + } + + return _classUnderTest; + } } - public TARGETCLASS CreatePartialMocked() + // I find it useful from time to time to use partial mocks for the ClassUnderTest + // Especially in Presenter testing + public void PartialMockTheClassUnderTest() { - return PartialMock<TARGETCLASS>(getConstructorArgs()); + _classUnderTest = PartialMock<TARGETCLASS>(getConstructorArgs()); } private object[] getConstructorArgs() @@ -50,14 +67,20 @@ return list.ToArray(); } - public T Service<T>() + // Get one of the mock objects that are injected into the constructor function + // of the ClassUnderTest + public T Get<T>() { return _manager.CreateInstance<T>(); } + // Set the auto mocking container to use a Stub for Type T public void InjectStub<T>(T stub) { _manager.InjectStub<T>(stub); } } + + + } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2008-01-29 02:02:34 UTC (rev 62) +++ trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs 2008-02-09 16:10:55 UTC (rev 63) @@ -157,10 +157,10 @@ StubService stub = new StubService(); autoMocker.InjectStub<IMockedService>(stub); - IMockedService2 service2 = autoMocker.Service<IMockedService2>(); - IMockedService3 service3 = autoMocker.Service<IMockedService3>(); + IMockedService2 service2 = autoMocker.Get<IMockedService2>(); + IMockedService3 service3 = autoMocker.Get<IMockedService3>(); - ConcreteClass concreteClass = autoMocker.Create(); + ConcreteClass concreteClass = autoMocker.ClassUnderTest; Assert.AreSame(stub, concreteClass.Service); Assert.AreSame(service2, concreteClass.Service2); @@ -172,11 +172,12 @@ { RhinoAutoMocker<ConcreteClass> autoMocker = new RhinoAutoMocker<ConcreteClass>(); - IMockedService service = autoMocker.Service<IMockedService>(); - IMockedService2 service2 = autoMocker.Service<IMockedService2>(); - IMockedService3 service3 = autoMocker.Service<IMockedService3>(); + IMockedService service = autoMocker.Get<IMockedService>(); + IMockedService2 service2 = autoMocker.Get<IMockedService2>(); + IMockedService3 service3 = autoMocker.Get<IMockedService3>(); - ConcreteClass concreteClass = autoMocker.CreatePartialMocked(); + autoMocker.PartialMockTheClassUnderTest(); + ConcreteClass concreteClass = autoMocker.ClassUnderTest; Assert.AreSame(service, concreteClass.Service); Assert.AreSame(service2, concreteClass.Service2); @@ -190,18 +191,30 @@ using (autoMocker.Record()) { - Expect.Call(autoMocker.Service<IMockedService>().Name).Return("Jeremy"); + Expect.Call(autoMocker.Get<IMockedService>().Name).Return("Jeremy"); } - Assert.AreEqual("Jeremy", autoMocker.Create().Name); + Assert.AreEqual("Jeremy", autoMocker.ClassUnderTest.Name); } [Test] + public void GetTheSameConcreteClassTwiceFromCreate() + { + RhinoAutoMocker<ConcreteClass> autoMocker = new RhinoAutoMocker<ConcreteClass>(); + ConcreteClass concreteClass = autoMocker.ClassUnderTest; + + Assert.AreSame(concreteClass, autoMocker.ClassUnderTest); + Assert.AreSame(concreteClass, autoMocker.ClassUnderTest); + Assert.AreSame(concreteClass, autoMocker.ClassUnderTest); + } + + [Test] public void UseTheAutoMockerToStartUpTheConcreteClassAsAPartialMockAndSetTheNameMethodUp() { RhinoAutoMocker<ConcreteClass> autoMocker = new RhinoAutoMocker<ConcreteClass>(); - ConcreteClass concreteClass = autoMocker.CreatePartialMocked(); + autoMocker.PartialMockTheClassUnderTest(); + ConcreteClass concreteClass = autoMocker.ClassUnderTest; using (autoMocker.Record()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-29 02:02:42
|
Revision: 62 http://structuremap.svn.sourceforge.net/structuremap/?rev=62&view=rev Author: jeremydmiller Date: 2008-01-28 18:02:34 -0800 (Mon, 28 Jan 2008) Log Message: ----------- temporary fix for an InjectStub problem Modified Paths: -------------- trunk/Source/StructureMap/InstanceFactory.cs Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-01-28 02:28:11 UTC (rev 61) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-01-29 02:02:34 UTC (rev 62) @@ -269,6 +269,10 @@ public void SetDefault(InstanceMemento memento) { _source.DefaultMemento = memento; + if (_source.GetMemento(memento.InstanceKey) == null) + { + _source.AddExternalMemento(memento); + } } /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-28 02:28:15
|
Revision: 61 http://structuremap.svn.sourceforge.net/structuremap/?rev=61&view=rev Author: jeremydmiller Date: 2008-01-27 18:28:11 -0800 (Sun, 27 Jan 2008) Log Message: ----------- convenience method on StructureMapConfiguration Modified Paths: -------------- trunk/Source/StructureMap/StructureMapConfiguration.cs Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-23 15:39:45 UTC (rev 60) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-28 02:28:11 UTC (rev 61) @@ -6,6 +6,7 @@ using StructureMap.Configuration.DSL; using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; +using StructureMap.Interceptors; using StructureMap.Verification; namespace StructureMap @@ -87,6 +88,11 @@ IgnoreStructureMapConfig = false; } + public static void RegisterInterceptor(TypeInterceptor interceptor) + { + _registry.RegisterInterceptor(interceptor); + } + /// <summary> /// Builds a PluginGraph object for the current configuration. Used by ObjectFactory. /// </summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-23 15:39:49
|
Revision: 60 http://structuremap.svn.sourceforge.net/structuremap/?rev=60&view=rev Author: jeremydmiller Date: 2008-01-23 07:39:45 -0800 (Wed, 23 Jan 2008) Log Message: ----------- building things by default without configuration Modified Paths: -------------- trunk/README.TXT trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/Source/XmlTemplater.cs trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs trunk/Source/StructureMap.Testing/TestData/DataMother.cs Modified: trunk/README.TXT =================================================================== --- trunk/README.TXT 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/README.TXT 2008-01-23 15:39:45 UTC (rev 60) @@ -1,4 +1,4 @@ -To start using StructureMap, either use the DLL's in the build folder or click on the RunBuild.BAT file to run the full NAnt build. There is a known issue with the build "sticking" on the custom NAnt tasks. If this happens, delete the copies of StructureMap.Dll and StructureMap.DeploymentTasks.Dll in the bin\NAnt folder. +To start using StructureMap, either use the DLL's in the build folder or click on the RunBuild.BAT file to run the full NAnt build. There is a known issue with the build "sticking" on the custom NAnt tasks. If this happens, delete the copies of StructureMap.Dll and StructureMap.DeploymentTasks.Dll in the bin\NAnt folder. Look in the "build" directory for the build products. A copy of the StructureMap website and documentation is in the "Docs" folder. Modified: trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -11,21 +11,31 @@ { private List<FetchNodeDelegate> _fetchers = new List<FetchNodeDelegate>(); private List<string> _otherFiles = new List<string>(); - private bool _useDefaultFile = true; + private bool _UseAndEnforceExistenceOfDefaultFile = false; + private bool _ignoreDefaultFile = false; - public bool UseDefaultFile + public bool UseAndEnforceExistenceOfDefaultFile { - get { return _useDefaultFile; } - set { _useDefaultFile = value; } + get { return _UseAndEnforceExistenceOfDefaultFile; } + set { _UseAndEnforceExistenceOfDefaultFile = value; } } + + public bool IgnoreDefaultFile + { + get { return _ignoreDefaultFile; } + set { _ignoreDefaultFile = value; } + } + public ConfigurationParser[] GetParsers() { List<ConfigurationParser> list = new List<ConfigurationParser>(); - if (_useDefaultFile) + // Pick up the configuration in the default StructureMap.config + string pathToStructureMapConfig = StructureMapConfiguration.GetStructureMapConfigurationPath(); + if ( (_UseAndEnforceExistenceOfDefaultFile || File.Exists(pathToStructureMapConfig)) && !_ignoreDefaultFile) { - addParsersFromFile(StructureMapConfiguration.GetStructureMapConfigurationPath(), list); + addParsersFromFile(pathToStructureMapConfig, list); } foreach (string file in _otherFiles) Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -80,17 +80,25 @@ { get { + // Preprocess a GenericType if (pluginType.IsGenericType && !_factories.ContainsKey(pluginType)) { PluginFamily family = _genericsGraph.CreateTemplatedFamily(pluginType); return registerPluginFamily(family); } + // Create a new InstanceFactory for a Concrete type if (!_factories.ContainsKey(pluginType)) { - throw new StructureMapException(208, pluginType.FullName); + if (pluginType.IsInterface || pluginType.IsAbstract) + { + throw new StructureMapException(208, pluginType.FullName); + } + + return getOrCreateFactory(pluginType); } + // Normal usage return _factories[pluginType]; } set { _factories[pluginType] = value; } @@ -390,15 +398,20 @@ throw new StructureMapException(230); } - IInstanceFactory factory = getOrCreateFactory(type, delegate(Type t) - { - PluginFamily family = - PluginFamily.CreateAutoFilledPluginFamily(t); - return new InstanceFactory(family, true); - }); + IInstanceFactory factory = getOrCreateFactory(type); return factory.GetInstance(); } + private IInstanceFactory getOrCreateFactory(Type type) + { + return getOrCreateFactory(type, delegate(Type t) + { + PluginFamily family = + PluginFamily.CreateAutoFilledPluginFamily(t); + return new InstanceFactory(family, true); + }); + } + protected IInstanceFactory getOrCreateFactory(Type type, CreateFactoryDelegate createFactory) { if (!_factories.ContainsKey(type)) Modified: trunk/Source/StructureMap/Source/XmlTemplater.cs =================================================================== --- trunk/Source/StructureMap/Source/XmlTemplater.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/Source/XmlTemplater.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections.Generic; using System.Text; using System.Xml; @@ -6,8 +6,8 @@ { public class XmlTemplater { - private string[] _substitutions; - private string _templateXml; + private readonly string[] _substitutions; + private readonly string _templateXml; public XmlTemplater(XmlNode templateNode) { @@ -62,7 +62,7 @@ private class Collector { private readonly XmlNode _templateNode; - private ArrayList _substitutionList = new ArrayList(); + private readonly List<string> _substitutionList = new List<string>(); public Collector(XmlNode templateNode) { @@ -73,7 +73,7 @@ { searchNode(_templateNode); - return (string[]) _substitutionList.ToArray(typeof (string)); + return _substitutionList.ToArray(); } private void searchNode(XmlNode node) Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -30,10 +30,17 @@ /// </summary> public static bool UseDefaultStructureMapConfigFile { - get { return _collection.UseDefaultFile; } - set { _collection.UseDefaultFile = value; } + get { return _collection.UseAndEnforceExistenceOfDefaultFile; } + set { _collection.UseAndEnforceExistenceOfDefaultFile = value; } } + + public static bool IgnoreStructureMapConfig + { + get { return _collection.IgnoreDefaultFile; } + set { _collection.IgnoreDefaultFile = value; } + } + public static bool PullConfigurationFromAppConfig { get { return _pullConfigurationFromAppConfig; } @@ -76,6 +83,8 @@ _registries.Add(_registry); _startUp = null; _pullConfigurationFromAppConfig = false; + UseDefaultStructureMapConfigFile = false; + IgnoreStructureMapConfig = false; } /// <summary> Modified: trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -14,6 +14,8 @@ [SetUp] public void SetUp() { + DataMother.BackupStructureMapConfig(); + ObjectFactory.ReInitialize(); StructureMapConfiguration.ResetAll(); DataMother.WriteDocument("Config1.xml"); @@ -26,6 +28,9 @@ { StructureMapConfiguration.ResetAll(); ObjectFactory.Reset(); + + + DataMother.RestoreStructureMapConfig(); } #endregion @@ -65,11 +70,19 @@ [Test] public void NotTheDefault() { - StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; - StructureMapConfiguration.IncludeConfigurationFromFile("Config1.xml"); - ObjectFactory.Reset(); + try + { + StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; + StructureMapConfiguration.IgnoreStructureMapConfig = true; + StructureMapConfiguration.IncludeConfigurationFromFile("Config1.xml"); + ObjectFactory.Reset(); - assertTheDefault("Orange"); + assertTheDefault("Orange"); + } + finally + { + DataMother.RestoreStructureMapConfig(); + } } [Test] Modified: trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Xml; using NUnit.Framework; using StructureMap.Configuration; @@ -15,8 +16,15 @@ public void SetUp() { _collection = new ConfigurationParserCollection(); + DataMother.BackupStructureMapConfig(); } + [TearDown] + public void TearDown() + { + DataMother.RestoreStructureMapConfig(); + } + #endregion private ConfigurationParserCollection _collection; @@ -38,7 +46,11 @@ [Test] public void DoNotUseDefaultAndUseADifferentFile() { - _collection.UseDefaultFile = false; + DataMother.RemoveStructureMapConfig(); + + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; + DataMother.WriteDocument("GenericsTesting.xml"); _collection.IncludeFile("GenericsTesting.xml"); @@ -51,7 +63,8 @@ )] public void FileDoesNotExist() { - _collection.UseDefaultFile = false; + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; _collection.IncludeFile("DoesNotExist.xml"); _collection.GetParsers(); } @@ -59,11 +72,14 @@ [Test] public void GetIncludes() { + DataMother.RemoveStructureMapConfig(); + DataMother.WriteDocument("Include1.xml"); DataMother.WriteDocument("Include2.xml"); DataMother.WriteDocument("Master.xml"); - _collection.UseDefaultFile = false; + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; _collection.IncludeFile("Master.xml"); assertParserIdList("Include1", "Include2", "Master"); @@ -79,7 +95,7 @@ DataMother.WriteDocument("GenericsTesting.xml"); _collection.IncludeFile("GenericsTesting.xml"); - _collection.UseDefaultFile = true; + _collection.UseAndEnforceExistenceOfDefaultFile = true; _collection.IncludeFile("Master.xml"); assertParserIdList("Generics", "Include1", "Include2", "Main", "Master"); @@ -88,6 +104,8 @@ [Test] public void GetXmlFromSomewhereElse() { + DataMother.RemoveStructureMapConfig(); + string xml = "<StructureMap Id=\"Somewhere\"/>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); @@ -95,7 +113,8 @@ FetchNodeDelegate fetcher = delegate { return doc.DocumentElement; }; _collection.IncludeNode(fetcher); - _collection.UseDefaultFile = false; + _collection.UseAndEnforceExistenceOfDefaultFile = false; + _collection.IgnoreDefaultFile = true; assertParserIdList("Somewhere"); } @@ -103,14 +122,14 @@ [Test] public void SimpleDefaultConfigurationParser() { - _collection.UseDefaultFile = true; + _collection.UseAndEnforceExistenceOfDefaultFile = true; assertParserIdList("Main"); } [Test] public void UseDefaultIsTrueUponConstruction() { - Assert.IsTrue(_collection.UseDefaultFile); + Assert.IsFalse(_collection.UseAndEnforceExistenceOfDefaultFile); } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -1,5 +1,6 @@ using System; using NUnit.Framework; +using StructureMap.Configuration.DSL; using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; @@ -145,5 +146,56 @@ InstanceManager manager = new InstanceManager(pluginGraph); Assert.AreSame(pluginGraph.DefaultManager, manager.DefaultManager); } + + [Test] + public void CanBuildConcreteTypesThatAreNotPreviouslyRegistered() + { + // Create a new InstanceManager that has a default instance configured for only the + // IProvider interface. InstanceManager is the real "container" behind ObjectFactory + Registry registry = new Registry(); + registry.ForRequestedType<IProvider>().TheDefaultIsConcreteType<Provider>(); + InstanceManager manager = (InstanceManager) registry.BuildInstanceManager(); + + // Now, have that same InstanceManager create a ClassThatUsesProvider. StructureMap will + // see that ClassThatUsesProvider is concrete, determine its constructor args, and build one + // for you with the default IProvider. No other configuration necessary. + ClassThatUsesProvider classThatUsesProvider = manager.CreateInstance<ClassThatUsesProvider>(); + Assert.IsInstanceOfType(typeof(Provider), classThatUsesProvider.Provider); + } + + [Test] + public void CanBuildConcreteTypesThatAreNotPreviouslyRegisteredWithArgumentsProvided() + { + Registry registry = new Registry(); + registry.ForRequestedType<IProvider>().TheDefaultIsConcreteType<Provider>(); + InstanceManager manager = (InstanceManager)registry.BuildInstanceManager(); + + DifferentProvider differentProvider = new DifferentProvider(); + ExplicitArguments args = new ExplicitArguments(); + args.Set<IProvider>(differentProvider); + + ClassThatUsesProvider classThatUsesProvider = manager.CreateInstance<ClassThatUsesProvider>(args); + Assert.AreSame(differentProvider, classThatUsesProvider.Provider); + } + + public interface IProvider{} + public class Provider : IProvider {} + public class ClassThatUsesProvider + { + private readonly IProvider _provider; + + public ClassThatUsesProvider(IProvider provider) + { + _provider = provider; + } + + + public IProvider Provider + { + get { return _provider; } + } + } + + public class DifferentProvider : IProvider{} } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/TestData/DataMother.cs =================================================================== --- trunk/Source/StructureMap.Testing/TestData/DataMother.cs 2008-01-17 17:46:06 UTC (rev 59) +++ trunk/Source/StructureMap.Testing/TestData/DataMother.cs 2008-01-23 15:39:45 UTC (rev 60) @@ -17,6 +17,26 @@ { } + public static void BackupStructureMapConfig() + { + if (File.Exists("StructureMap.config.bak")) File.Delete("StructureMap.config.bak"); + File.Copy("StructureMap.config", "StructureMap.config.bak"); + } + + public static void RestoreStructureMapConfig() + { + if (!File.Exists("StructureMap.config")) + { + File.Copy("StructureMap.config.bak", "StructureMap.config"); + } + + } + + public static void RemoveStructureMapConfig() + { + if (File.Exists("StructureMap.config")) File.Delete("StructureMap.config"); + } + public static XmlDocument GetXmlDocument(string fileName) { XmlDocument document = new XmlDocument(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-17 17:46:09
|
Revision: 59 http://structuremap.svn.sourceforge.net/structuremap/?rev=59&view=rev Author: jeremydmiller Date: 2008-01-17 09:46:06 -0800 (Thu, 17 Jan 2008) Log Message: ----------- the explicit argument functionality Modified Paths: -------------- trunk/Source/StructureMap/AssemblyInfo.cs trunk/Source/StructureMap/IInstanceCreator.cs trunk/Source/StructureMap/IInstanceManager.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj Added Paths: ----------- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs Modified: trunk/Source/StructureMap/AssemblyInfo.cs =================================================================== --- trunk/Source/StructureMap/AssemblyInfo.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/AssemblyInfo.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -1,4 +1,5 @@ using System.Reflection; +using System.Runtime.CompilerServices; // // General Information about an assembly is controlled through the following @@ -7,4 +8,5 @@ // [assembly : AssemblyTitle("StructureMap")] -[assembly : AssemblyDescription("Main Library")] \ No newline at end of file +[assembly : AssemblyDescription("Main Library")] +[assembly : InternalsVisibleTo("StructureMap.AutoMocking")] \ No newline at end of file Added: trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/Mementos/ExplicitArgumentMemento.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Text; +using StructureMap.Graph; + +namespace StructureMap.Configuration.Mementos +{ + public class ExplicitArgumentMemento : InstanceMemento + { + private readonly ExplicitArguments _args; + private InstanceMemento _inner; + + public ExplicitArgumentMemento(ExplicitArguments args, InstanceMemento inner) + { + _args = args; + _inner = inner; + } + + + protected override object buildInstance(IInstanceCreator creator) + { + if (_inner == null) + { + _inner = creator.DefaultMemento; + } + + return base.buildInstance(creator); + } + + protected override string innerConcreteKey + { + get { return _inner.ConcreteKey; } + } + + protected override string innerInstanceKey + { + get { return _inner.InstanceKey; } + } + + public override bool IsReference + { + get { return false; } + } + + public override string ReferenceKey + { + get { return _inner.ReferenceKey; } + } + + protected override string getPropertyValue(string Key) + { + return _args.GetArg(Key) ?? _inner.GetProperty(Key); + } + + protected override InstanceMemento getChild(string Key) + { + return _inner.GetChildMemento(Key); + } + + public override object GetChild(string key, string typeName, InstanceManager manager) + { + Type type = Type.GetType(typeName, true); + return _args.Get(type) ?? base.GetChild(key, typeName, manager); + } + + public override InstanceMemento[] GetChildrenArray(string Key) + { + return _inner.GetChildrenArray(Key); + } + } +} Added: trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/Mementos/ExplicitArguments.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureMap.Configuration.Mementos +{ + public class ExplicitArguments + { + private readonly Dictionary<Type, object> _children = new Dictionary<Type, object>(); + private readonly Dictionary<string, string> _args = new Dictionary<string, string>(); + + public T Get<T>() where T : class + { + return (T) Get(typeof(T)); + } + + public object Get(Type type) + { + return _children.ContainsKey(type) ? _children[type] : null; + } + + public void Set<T>(T arg) + { + _children.Add(typeof(T), arg); + } + + public void SetArg(string key, object argValue) + { + _args.Add(key, argValue.ToString()); + } + + public string GetArg(string key) + { + return _args.ContainsKey(key) ? _args[key] : null; + } + } +} Modified: trunk/Source/StructureMap/IInstanceCreator.cs =================================================================== --- trunk/Source/StructureMap/IInstanceCreator.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/IInstanceCreator.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -3,5 +3,6 @@ public interface IInstanceCreator { object BuildInstance(InstanceMemento memento); + InstanceMemento DefaultMemento{ get;} } } \ No newline at end of file Modified: trunk/Source/StructureMap/IInstanceManager.cs =================================================================== --- trunk/Source/StructureMap/IInstanceManager.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/IInstanceManager.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -1,4 +1,7 @@ +using System; +using System.Collections; using System.Collections.Generic; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap @@ -9,10 +12,73 @@ T CreateInstance<T>(string instanceKey); T CreateInstance<T>(); T FillDependencies<T>(); + object FillDependencies(Type type); void InjectStub<T>(T instance); IList<T> GetAllInstances<T>(); void SetDefaultsToProfile(string profile); T CreateInstance<T>(InstanceMemento memento); + + /// <summary> + /// Sets up the InstanceManager to return the object in the "stub" argument anytime + /// any instance of the PluginType is requested + /// </summary> + /// <param name="pluginType"></param> + /// <param name="stub"></param> + void InjectStub(Type pluginType, object stub); + + IList GetAllInstances(Type type); + void AddInstance<T>(InstanceMemento memento); + void AddInstance<PLUGINTYPE, CONCRETETYPE>(); + void AddDefaultInstance<PLUGINTYPE, CONCRETETYPE>(); + string WhatDoIHave(); + + /// <summary> + /// Sets the default instance for the PluginType + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceMemento"></param> + void SetDefault(Type pluginType, InstanceMemento instanceMemento); + + /// <summary> + /// Sets the default instance for the PluginType + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceKey"></param> + void SetDefault(Type pluginType, string instanceKey); + + /// <summary> + /// Sets the default instance for the PluginType + /// </summary> + /// <param name="pluginTypeName"></param> + /// <param name="instanceKey"></param> + void SetDefault(string pluginTypeName, string instanceKey); + + /// <summary> + /// Creates a new object instance of the requested type + /// </summary> + /// <param name="pluginType"></param> + /// <returns></returns> + object CreateInstance(Type pluginType); + + + /// <summary> + /// Creates a new instance of the requested type using the InstanceMemento. Mostly used from other + /// classes to link children members + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceMemento"></param> + /// <returns></returns> + object CreateInstance(Type pluginType, InstanceMemento instanceMemento); + + /// <summary> + /// Creates the named instance of the PluginType + /// </summary> + /// <param name="pluginType"></param> + /// <param name="instanceKey"></param> + /// <returns></returns> + object CreateInstance(Type pluginType, string instanceKey); + + PLUGINTYPE CreateInstance<PLUGINTYPE>(ExplicitArguments args); } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -385,5 +385,11 @@ 201, memento.ConcreteKey, memento.InstanceKey, PluginType.FullName); } } + + + InstanceMemento IInstanceCreator.DefaultMemento + { + get { return _source.DefaultMemento; } + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Text; using StructureMap.Configuration.Mementos; using StructureMap.Exceptions; using StructureMap.Graph; @@ -147,6 +148,13 @@ return (T) CreateInstance(typeof (T), memento); } + public PLUGINTYPE CreateInstance<PLUGINTYPE>(ExplicitArguments args) + { + ExplicitArgumentMemento memento = new ExplicitArgumentMemento(args, null); + return CreateInstance<PLUGINTYPE>(memento); + + } + public T CreateInstance<T>() { return (T) CreateInstance(typeof (T)); @@ -266,6 +274,8 @@ return instanceFactory.GetInstance(instanceKey); } + + /// <summary> /// Creates a new object instance of the requested type /// </summary> @@ -461,5 +471,18 @@ protected delegate InstanceFactory CreateFactoryDelegate(Type type); #endregion + + public string WhatDoIHave() + { + StringBuilder sb = new StringBuilder(); + + foreach (IInstanceFactory factory in this) + { + sb.AppendFormat("PluginType {0}, Default: {1}\r\n", factory.PluginType.AssemblyQualifiedName, + factory.DefaultInstanceKey); + } + + return sb.ToString(); + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/InstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/InstanceMemento.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/InstanceMemento.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -180,6 +180,7 @@ /// <returns></returns> protected abstract InstanceMemento getChild(string Key); + /// <summary> /// Using InstanceManager and the TypeName, creates an object instance using the /// child InstanceMemento specified by Key @@ -188,7 +189,7 @@ /// <param name="typeName"></param> /// <param name="manager"></param> /// <returns></returns> - public object GetChild(string key, string typeName, InstanceManager manager) + public virtual object GetChild(string key, string typeName, InstanceManager manager) { InstanceMemento memento = GetChildMemento(key); object returnValue = null; Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/ObjectFactory.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -16,8 +16,8 @@ [EnvironmentPermission(SecurityAction.Assert, Read="COMPUTERNAME")] public class ObjectFactory { - private static object _lockObject = new object(); - private static InstanceManager _manager; + private static readonly object _lockObject = new object(); + private static IInstanceManager _manager; private static string _profile = string.Empty; @@ -79,15 +79,7 @@ public static string WhatDoIHave() { - StringBuilder sb = new StringBuilder(); - - foreach (IInstanceFactory factory in manager) - { - sb.AppendFormat("PluginType {0}, Default: {1}\r\n", factory.PluginType.AssemblyQualifiedName, - factory.DefaultInstanceKey); - } - - return sb.ToString(); + return _manager.WhatDoIHave(); } /// <summary> @@ -151,7 +143,7 @@ #region InstanceManager and setting defaults - private static InstanceManager manager + private static IInstanceManager manager { get { @@ -200,7 +192,16 @@ } } + /// <summary> + /// Strictly used for testing scenarios + /// </summary> + /// <param name="manager"></param> + internal static void ReplaceManager(IInstanceManager manager) + { + _manager = manager; + } + /// <summary> /// Fires when the ObjectFactory is refreshed /// </summary> @@ -374,6 +375,57 @@ return specificInstances; } + public static ExplicitArgsExpression With<T>(T arg) + { + return new ExplicitArgsExpression(manager).With<T>(arg); + } + + public static IExplicitProperty With(string argName) + { + return new ExplicitArgsExpression(manager).With(argName); + } + + public interface IExplicitProperty + { + ExplicitArgsExpression EqualTo(object value); + } + + public class ExplicitArgsExpression : IExplicitProperty + { + private readonly IInstanceManager _manager; + private readonly ExplicitArguments _args = new ExplicitArguments(); + private string _lastArgName; + + internal ExplicitArgsExpression(IInstanceManager manager) + { + _manager = manager; + } + + public ExplicitArgsExpression With<T>(T arg) + { + _args.Set<T>(arg); + return this; + } + + public IExplicitProperty With(string argName) + { + _lastArgName = argName; + return this; + } + + + public T GetInstance<T>() + { + return _manager.CreateInstance<T>(_args); + } + + ExplicitArgsExpression IExplicitProperty.EqualTo(object value) + { + _args.SetArg(_lastArgName, value); + return this; + } + } + #endregion } } \ No newline at end of file Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-01-17 17:46:06 UTC (rev 59) @@ -219,6 +219,8 @@ <Compile Include="Configuration\DSL\Expressions\InstanceDefaultExpression.cs" /> <Compile Include="Configuration\DSL\Expressions\InstanceExpression.cs" /> <Compile Include="Configuration\DSL\Expressions\LiteralExpression.cs" /> + <Compile Include="Configuration\Mementos\ExplicitArgumentMemento.cs" /> + <Compile Include="Configuration\Mementos\ExplicitArguments.cs" /> <Compile Include="Configuration\Mementos\LiteralMemento.cs" /> <Compile Include="Configuration\DSL\Expressions\MementoBuilder.cs" /> <Compile Include="Configuration\DSL\Expressions\ProfileExpression.cs" /> Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -173,6 +173,16 @@ } /// <summary> + /// Direct StructureMap to create instances of Type T + /// </summary> + /// <typeparam name="PLUGINTYPE">The Type to build</typeparam> + /// <returns></returns> + public static CreatePluginFamilyExpression<PLUGINTYPE> ForRequestedType<PLUGINTYPE>() + { + return _registry.BuildInstancesOf<PLUGINTYPE>(); + } + + /// <summary> /// Adds a new configured instance of Type T /// </summary> /// <typeparam name="T"></typeparam> Modified: trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -13,7 +13,7 @@ public class RhinoAutoMocker<TARGETCLASS> : MockRepository where TARGETCLASS : class { - private AutoMockedInstanceManager _manager; + private readonly AutoMockedInstanceManager _manager; public RhinoAutoMocker() { @@ -21,6 +21,11 @@ _manager = new AutoMockedInstanceManager(locator); } + public void MockObjectFactory() + { + ObjectFactory.ReplaceManager(_manager); + } + public TARGETCLASS Create() { return _manager.FillDependencies<TARGETCLASS>(); Added: trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Container/ExplicitArgumentTester.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -0,0 +1,232 @@ +using NUnit.Framework; +using StructureMap.Configuration.DSL; +using StructureMap.Configuration.Mementos; +using StructureMap.Graph; + +namespace StructureMap.Testing.Container +{ + [TestFixture] + public class ExplicitArgumentTester + { + #region Setup/Teardown + + [SetUp] + public void SetUp() + { + StructureMapConfiguration.ResetAll(); + StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; + } + + [TearDown] + public void TearDown() + { + StructureMapConfiguration.ResetAll(); + ObjectFactory.Reset(); + + } + + #endregion + + public void GetTypedArgumentsFromAnExplicitArgumentsMementoIfThereIsAnExplicitArgument() + { + PluginGraph pluginGraph = new PluginGraph(); + using (Registry registry = new Registry(pluginGraph)) + { + registry.ForRequestedType<ExplicitTarget>().TheDefaultIs( + Registry.Instance<ExplicitTarget>() + .UsingConcreteType<ExplicitTarget>() + .Child<IProvider>().IsConcreteType<RedProvider>() + .WithProperty("name").EqualTo("Jeremy") + ); + } + + InstanceMemento inner = pluginGraph.PluginFamilies[typeof (ExplicitTarget)].Source.GetAllMementos()[0]; + ExplicitArguments args = new ExplicitArguments(); + ExplicitArgumentMemento memento = new ExplicitArgumentMemento(args, inner); + + InstanceManager manager = new InstanceManager(pluginGraph); + + // Get the ExplicitTarget without setting an explicit arg for IProvider + ExplicitTarget firstTarget = manager.CreateInstance<ExplicitTarget>(memento); + Assert.IsInstanceOfType(typeof (RedProvider), firstTarget.Provider); + + // Now, set the explicit arg for IProvider + args.Set<IProvider>(new BlueProvider()); + ExplicitTarget secondTarget = manager.CreateInstance<ExplicitTarget>(memento); + Assert.IsInstanceOfType(typeof (BlueProvider), secondTarget.Provider); + } + + + public interface IExplicitTarget + { + } + + public class RedTarget : IExplicitTarget + { + } + + public class GreenTarget : IExplicitTarget + { + } + + public class ExplicitTarget : IExplicitTarget + { + private readonly string _name; + private readonly IProvider _provider; + + public ExplicitTarget(string name, IProvider provider) + { + _name = name; + _provider = provider; + } + + + public string Name + { + get { return _name; } + } + + public IProvider Provider + { + get { return _provider; } + } + } + + public interface IProvider + { + } + + public class RedProvider : IProvider + { + } + + public class BlueProvider : IProvider + { + } + + [Test] + public void NowDoItWithObjectFactoryItself() + { + StructureMapConfiguration.ForRequestedType<ExplicitTarget>().TheDefaultIs( + Registry.Instance<ExplicitTarget>() + .UsingConcreteType<ExplicitTarget>() + .Child<IProvider>().IsConcreteType<RedProvider>() + .WithProperty("name").EqualTo("Jeremy") + ); + + ObjectFactory.Reset(); + + // Get the ExplicitTarget without setting an explicit arg for IProvider + ExplicitTarget firstTarget = ObjectFactory.GetInstance<ExplicitTarget>(); + Assert.IsInstanceOfType(typeof (RedProvider), firstTarget.Provider); + + // Now, set the explicit arg for IProvider + BlueProvider theBlueProvider = new BlueProvider(); + ExplicitTarget secondTarget = ObjectFactory.With<IProvider>(theBlueProvider).GetInstance<ExplicitTarget>(); + Assert.AreSame(theBlueProvider, secondTarget.Provider); + } + + [Test] + public void OverrideAPrimitiveWithObjectFactory() + { + StructureMapConfiguration.ForRequestedType<ExplicitTarget>().TheDefaultIs( + Registry.Instance<ExplicitTarget>() + .UsingConcreteType<ExplicitTarget>() + .Child<IProvider>().IsConcreteType<RedProvider>() + .WithProperty("name").EqualTo("Jeremy") + ); + + ObjectFactory.Reset(); + + // Get the ExplicitTarget without setting an explicit arg for IProvider + ExplicitTarget firstTarget = ObjectFactory.GetInstance<ExplicitTarget>(); + Assert.AreEqual("Jeremy", firstTarget.Name); + + // Now, set the explicit arg for IProvider + ExplicitTarget secondTarget = ObjectFactory.With("name").EqualTo("Julia").GetInstance<ExplicitTarget>(); + Assert.AreEqual("Julia", secondTarget.Name); + } + + [Test] + public void OverridePrimitiveArgs() + { + PluginGraph pluginGraph = new PluginGraph(); + using (Registry registry = new Registry(pluginGraph)) + { + registry.ForRequestedType<ExplicitTarget>().TheDefaultIs( + Registry.Instance<ExplicitTarget>() + .UsingConcreteType<ExplicitTarget>() + .Child<IProvider>().IsConcreteType<RedProvider>() + .WithProperty("name").EqualTo("Jeremy") + ); + } + + InstanceMemento inner = pluginGraph.PluginFamilies[typeof (ExplicitTarget)].Source.GetAllMementos()[0]; + ExplicitArguments args = new ExplicitArguments(); + ExplicitArgumentMemento memento = new ExplicitArgumentMemento(args, inner); + + InstanceManager manager = new InstanceManager(pluginGraph); + + // Once without an explicit arg set + Assert.AreEqual("Jeremy", manager.CreateInstance<ExplicitTarget>(memento).Name); + + // Now, set the explicit arg + args.SetArg("name", "Max"); + Assert.AreEqual("Max", manager.CreateInstance<ExplicitTarget>(memento).Name); + } + + [Test] + public void PassExplicitArgsIntoInstanceManager() + { + Registry registry = new Registry(); + + registry.ForRequestedType<ExplicitTarget>().TheDefaultIs( + Registry.Instance<ExplicitTarget>() + .UsingConcreteType<ExplicitTarget>() + .Child<IProvider>().IsConcreteType<RedProvider>() + .WithProperty("name").EqualTo("Jeremy") + ); + + IInstanceManager manager = registry.BuildInstanceManager(); + + ExplicitArguments args = new ExplicitArguments(); + + // Get the ExplicitTarget without setting an explicit arg for IProvider + ExplicitTarget firstTarget = manager.CreateInstance<ExplicitTarget>(args); + Assert.IsInstanceOfType(typeof (RedProvider), firstTarget.Provider); + + // Now, set the explicit arg for IProvider + args.Set<IProvider>(new BlueProvider()); + ExplicitTarget secondTarget = manager.CreateInstance<ExplicitTarget>(args); + Assert.IsInstanceOfType(typeof (BlueProvider), secondTarget.Provider); + } + + [Test] + public void RegisterAndFindServicesOnTheExplicitArgument() + { + ExplicitArguments args = new ExplicitArguments(); + Assert.IsNull(args.Get<IProvider>()); + + RedProvider red = new RedProvider(); + args.Set<IProvider>(red); + + Assert.AreSame(red, args.Get<IProvider>()); + + args.Set<IExplicitTarget>(new RedTarget()); + Assert.IsInstanceOfType(typeof (RedTarget), args.Get<IExplicitTarget>()); + } + + [Test] + public void RegisterAndRetrieveArgs() + { + ExplicitArguments args = new ExplicitArguments(); + Assert.IsNull(args.GetArg("name")); + + args.SetArg("name", "Jeremy"); + Assert.AreEqual("Jeremy", args.GetArg("name")); + + args.SetArg("age", 34); + Assert.AreEqual("34", args.GetArg("age")); + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs 2008-01-17 17:46:06 UTC (rev 59) @@ -67,6 +67,13 @@ Assert.IsNotNull(target.Rule); } + [Test] + public void FillDependenc1ies2() + { + FilledTarget target = ObjectFactory.FillDependencies<FilledTarget>(); + Assert.IsNotNull(target.Gateway); + Assert.IsNotNull(target.Rule); + } [Test] public void GetChildWithDefinedGrandChild() Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-01-16 14:23:24 UTC (rev 58) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-01-17 17:46:06 UTC (rev 59) @@ -296,6 +296,7 @@ <Compile Include="Container\ExceptionHandling\StructureMapExceptionTester.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Container\ExplicitArgumentTester.cs" /> <Compile Include="Container\FillDependenciesTester.cs"> <SubType>Code</SubType> </Compile> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-16 14:23:28
|
Revision: 58 http://structuremap.svn.sourceforge.net/structuremap/?rev=58&view=rev Author: jeremydmiller Date: 2008-01-16 06:23:24 -0800 (Wed, 16 Jan 2008) Log Message: ----------- adding work to interception cleanup Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs trunk/Source/StructureMap/StructureMap.csproj Added Paths: ----------- trunk/Source/StructureMap/Interceptors/FilteredInstanceInterceptor.cs Removed Paths: ------------- trunk/Source/StructureMap/Delegates.cs Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-15 15:56:14 UTC (rev 57) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-16 14:23:24 UTC (rev 58) @@ -6,6 +6,8 @@ namespace StructureMap.Configuration.DSL { + public delegate object InterceptionDelegate(object target); + public class Registry : IDisposable { private readonly List<IExpression> _expressions = new List<IExpression>(); Modified: trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs 2008-01-15 15:56:14 UTC (rev 57) +++ trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs 2008-01-16 14:23:24 UTC (rev 58) @@ -50,11 +50,11 @@ #endregion - private Hashtable _children = new Hashtable(); - private string _concreteKey; + private readonly Hashtable _children = new Hashtable(); + private readonly string _concreteKey; private string _instanceKey; private bool _isReference; - private NameValueCollection _properties = new NameValueCollection(); + private readonly NameValueCollection _properties = new NameValueCollection(); private string _referenceKey; @@ -66,6 +66,7 @@ public MemoryInstanceMemento(string concreteKey, string instanceKey) : this(concreteKey, instanceKey, new NameValueCollection()) { + } Deleted: trunk/Source/StructureMap/Delegates.cs =================================================================== --- trunk/Source/StructureMap/Delegates.cs 2008-01-15 15:56:14 UTC (rev 57) +++ trunk/Source/StructureMap/Delegates.cs 2008-01-16 14:23:24 UTC (rev 58) @@ -1,4 +0,0 @@ -namespace StructureMap -{ - public delegate object InterceptionDelegate(object instance); -} \ No newline at end of file Added: trunk/Source/StructureMap/Interceptors/FilteredInstanceInterceptor.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/FilteredInstanceInterceptor.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/FilteredInstanceInterceptor.cs 2008-01-16 14:23:24 UTC (rev 58) @@ -0,0 +1,9 @@ +using System; + +namespace StructureMap.Interceptors +{ + public interface TypeInterceptor : InstanceInterceptor + { + bool MatchesType(Type type); + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-01-15 15:56:14 UTC (rev 57) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-01-16 14:23:24 UTC (rev 58) @@ -335,7 +335,6 @@ <SubType>Code</SubType> </Compile> <Compile Include="ConstructorMemento.cs" /> - <Compile Include="Delegates.cs" /> <Compile Include="DeploymentTasks\DeploymentConfiguration.cs"> <SubType>Code</SubType> </Compile> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-15 15:56:18
|
Revision: 57 http://structuremap.svn.sourceforge.net/structuremap/?rev=57&view=rev Author: jeremydmiller Date: 2008-01-15 07:56:14 -0800 (Tue, 15 Jan 2008) Log Message: ----------- reformatting the code Modified Paths: -------------- trunk/Source/StructureMap/AssemblyInfo.cs trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs trunk/Source/StructureMap/Caching/CacheItem.cs trunk/Source/StructureMap/Caching/CacheManager.cs trunk/Source/StructureMap/Caching/CloneStorageStrategy.cs trunk/Source/StructureMap/Caching/Expirations/AbsoluteTimeExpirationPolicy.cs trunk/Source/StructureMap/Caching/Expirations/SlidingTimeExpirationPolicy.cs trunk/Source/StructureMap/Caching/FileModificationWatcher.cs trunk/Source/StructureMap/Caching/LazyCache.cs trunk/Source/StructureMap/Caching/SerializationStorageStrategy.cs trunk/Source/StructureMap/Caching/SharedStorageStrategy.cs trunk/Source/StructureMap/Configuration/ConfigurationConstants.cs trunk/Source/StructureMap/Configuration/ConfigurationParser.cs trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs trunk/Source/StructureMap/Configuration/DSL/ExpressionValidator.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs trunk/Source/StructureMap/Configuration/DiagnosticGraphBuilder.cs trunk/Source/StructureMap/Configuration/GraphObject.cs trunk/Source/StructureMap/Configuration/IGraphBuilder.cs trunk/Source/StructureMap/Configuration/InstanceValidator.cs trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs trunk/Source/StructureMap/Configuration/NormalGraphBuilder.cs trunk/Source/StructureMap/Configuration/PluginGraphReport.cs trunk/Source/StructureMap/Configuration/Problem.cs trunk/Source/StructureMap/Configuration/ProblemFinder.cs trunk/Source/StructureMap/Configuration/ProfileAndMachineParser.cs trunk/Source/StructureMap/Configuration/StructureMapConfigurationSection.cs trunk/Source/StructureMap/Configuration/Tokens/AssemblyToken.cs trunk/Source/StructureMap/Configuration/Tokens/Deployable.cs trunk/Source/StructureMap/Configuration/Tokens/FamilyToken.cs trunk/Source/StructureMap/Configuration/Tokens/InstanceToken.cs trunk/Source/StructureMap/Configuration/Tokens/InterceptorInstanceToken.cs trunk/Source/StructureMap/Configuration/Tokens/MementoSourceInstanceToken.cs trunk/Source/StructureMap/Configuration/Tokens/PluginToken.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/ChildArrayProperty.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/ChildProperty.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/DefaultChildPropertyMode.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/InlineInstanceChildPropertyMode.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/NulloChildPropertyMode.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/Property.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/ReferencedChildPropertyMode.cs trunk/Source/StructureMap/Configuration/Tokens/Properties/TemplateProperty.cs trunk/Source/StructureMap/Configuration/Tokens/PropertyDefinition.cs trunk/Source/StructureMap/Configuration/Tokens/TemplateToken.cs trunk/Source/StructureMap/Configuration/XmlConstants.cs trunk/Source/StructureMap/ConstructorMemento.cs trunk/Source/StructureMap/Delegates.cs trunk/Source/StructureMap/DeploymentTasks/DeploymentConfiguration.cs trunk/Source/StructureMap/DeploymentTasks/DeploymentExecutor.cs trunk/Source/StructureMap/DeploymentTasks/PluginGraphFilter.cs trunk/Source/StructureMap/Emitting/ClassBuilder.cs trunk/Source/StructureMap/Emitting/DynamicAssembly.cs trunk/Source/StructureMap/Emitting/Method.cs trunk/Source/StructureMap/Exceptions/StructureMapException.cs trunk/Source/StructureMap/Graph/AssemblyGraph.cs trunk/Source/StructureMap/Graph/AssemblyGraphCollection.cs trunk/Source/StructureMap/Graph/Deployable.cs trunk/Source/StructureMap/Graph/GenericsPluginGraph.cs trunk/Source/StructureMap/Graph/InstanceDefault.cs trunk/Source/StructureMap/Graph/InstanceDefaultManager.cs trunk/Source/StructureMap/Graph/InterceptionChain.cs trunk/Source/StructureMap/Graph/MachineOverride.cs trunk/Source/StructureMap/Graph/Plugin.cs trunk/Source/StructureMap/Graph/PluginCollection.cs trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/Graph/PluginFamilyCollection.cs trunk/Source/StructureMap/Graph/PluginGraph.cs trunk/Source/StructureMap/Graph/PluginGraphObjectCollection.cs trunk/Source/StructureMap/Graph/Profile.cs trunk/Source/StructureMap/Graph/RemoteGraph.cs trunk/Source/StructureMap/Graph/SetterPropertyCollection.cs trunk/Source/StructureMap/Graph/TypePath.cs trunk/Source/StructureMap/IInstanceFactory.cs trunk/Source/StructureMap/IInstanceManager.cs trunk/Source/StructureMap/IPluginGraphSource.cs trunk/Source/StructureMap/InstanceBuilder.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/Interceptors/CompoundInterceptor.cs trunk/Source/StructureMap/Interceptors/EnrichmentInterceptor.cs trunk/Source/StructureMap/Interceptors/HttpContextItemInterceptor.cs trunk/Source/StructureMap/Interceptors/InstanceFactoryInterceptor.cs trunk/Source/StructureMap/Interceptors/InterceptorChainBuilder.cs trunk/Source/StructureMap/Interceptors/Interceptors.cs trunk/Source/StructureMap/Interceptors/NulloInterceptor.cs trunk/Source/StructureMap/Interceptors/StartupInterceptor.cs trunk/Source/StructureMap/MementoSource.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap/ObjectFactoryCacheCallback.cs trunk/Source/StructureMap/PluginGraphBuilder.cs trunk/Source/StructureMap/Source/BasicXmlMementoSource.cs trunk/Source/StructureMap/Source/DirectoryXmlMementoSource.cs trunk/Source/StructureMap/Source/EmbeddedFolderXmlMementoSource.cs trunk/Source/StructureMap/Source/MemoryMementoSource.cs trunk/Source/StructureMap/Source/SingleEmbeddedXmlMementoSource.cs trunk/Source/StructureMap/Source/TemplatedMementoSource.cs trunk/Source/StructureMap/Source/XmlAttributeInstanceMemento.cs trunk/Source/StructureMap/Source/XmlFileMementoSource.cs trunk/Source/StructureMap/Source/XmlMementoCreator.cs trunk/Source/StructureMap/Source/XmlMementoSource.cs trunk/Source/StructureMap/Source/XmlNodeInstanceMemento.cs trunk/Source/StructureMap/Source/XmlTemplater.cs trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap/Verification/PluginGraphConsoleWriter.cs trunk/Source/StructureMap/Verification/StartUp.cs trunk/Source/StructureMap.AutoMocking/AutoMockedInstanceManager.cs trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs trunk/Source/StructureMap.AutoMocking/Properties/AssemblyInfo.cs trunk/Source/StructureMap.AutoMocking/RhinoAutoMocker.cs trunk/Source/StructureMap.AutoMocking/RhinoMocksServiceLocator.cs trunk/Source/StructureMap.Client/AssemblyInfo.cs trunk/Source/StructureMap.Client/Controllers/HTMLSourceFactory.cs trunk/Source/StructureMap.Client/Controllers/ReportSource.cs trunk/Source/StructureMap.Client/Controllers/TreeBuilder.cs trunk/Source/StructureMap.Client/Shell/ApplicationShell.cs trunk/Source/StructureMap.Client/Shell/SearchPart.cs trunk/Source/StructureMap.Client/TreeNodes/GraphObjectNode.cs trunk/Source/StructureMap.Client/Views/BasicView.cs trunk/Source/StructureMap.Client/Views/CellMaker.cs trunk/Source/StructureMap.Client/Views/ChildHeader.cs trunk/Source/StructureMap.Client/Views/Column.cs trunk/Source/StructureMap.Client/Views/GridView.cs trunk/Source/StructureMap.Client/Views/HTMLBuilder.cs trunk/Source/StructureMap.Client/Views/IColumn.cs trunk/Source/StructureMap.Client/Views/IndexColumn.cs trunk/Source/StructureMap.Client/Views/InstanceHierarchyView.cs trunk/Source/StructureMap.Client/Views/ProblemColumn.cs trunk/Source/StructureMap.Client/Views/ProblemView.cs trunk/Source/StructureMap.Client/Views/RecordView.cs trunk/Source/StructureMap.Client/Views/SummaryView.cs trunk/Source/StructureMap.Client/Views/TableMaker.cs trunk/Source/StructureMap.Client/Views/ViewConstants.cs trunk/Source/StructureMap.DataAccess/AssemblyInfo.cs trunk/Source/StructureMap.DataAccess/CommandCollection.cs trunk/Source/StructureMap.DataAccess/CommandFactory.cs trunk/Source/StructureMap.DataAccess/CommandFailureException.cs trunk/Source/StructureMap.DataAccess/Commands/CommandBase.cs trunk/Source/StructureMap.DataAccess/Commands/QueryFilter.cs trunk/Source/StructureMap.DataAccess/Commands/StoredProcedureCommand.cs trunk/Source/StructureMap.DataAccess/Commands/TemplatedCommand.cs trunk/Source/StructureMap.DataAccess/Commands/TemplatedQuery.cs trunk/Source/StructureMap.DataAccess/DataSession.cs trunk/Source/StructureMap.DataAccess/DataSetMapping/ReaderToColumnMap.cs trunk/Source/StructureMap.DataAccess/DataSetMapping/YesNoReaderToColumnMap.cs trunk/Source/StructureMap.DataAccess/DefaultConnectionStringProvider.cs trunk/Source/StructureMap.DataAccess/ExecutionStates/AutoCommitExecutionState.cs trunk/Source/StructureMap.DataAccess/ExecutionStates/TransactionalExecutionState.cs trunk/Source/StructureMap.DataAccess/ICommand.cs trunk/Source/StructureMap.DataAccess/IDataSession.cs trunk/Source/StructureMap.DataAccess/IParameter.cs trunk/Source/StructureMap.DataAccess/IReaderSource.cs trunk/Source/StructureMap.DataAccess/JSON/Field.cs trunk/Source/StructureMap.DataAccess/JSON/JSONProperty.cs trunk/Source/StructureMap.DataAccess/MSSQL/MSSQLDatabaseEngine.cs trunk/Source/StructureMap.DataAccess/ParameterCollection.cs trunk/Source/StructureMap.DataAccess/Parameterization/BasicParameterTemplate.cs trunk/Source/StructureMap.DataAccess/Parameterization/IParameterTemplate.cs trunk/Source/StructureMap.DataAccess/Parameterization/ParameterizedCommandBuilder.cs trunk/Source/StructureMap.DataAccess/Parameterization/StringParameterTemplate.cs trunk/Source/StructureMap.DataAccess/Parameters/Parameter.cs trunk/Source/StructureMap.DataAccess/Parameters/TemplateParameter.cs trunk/Source/StructureMap.DataAccess/ReaderSourceCollection.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/CommandExpectation.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/MockCommand.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/MockDataSession.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/MockReaderSource.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/ParameterList.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/ParameterValidationFailureException.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/ReaderExpectation.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/StubbedCommandCollection.cs trunk/Source/StructureMap.DataAccess/Tools/Mocks/StubbedReaderSourceCollection.cs trunk/Source/StructureMap.DataAccess/Tools/TableDataReader.cs trunk/Source/StructureMap.DeploymentTasks/AddAssembly.cs trunk/Source/StructureMap.DeploymentTasks/AssemblyInfo.cs trunk/Source/StructureMap.DeploymentTasks/Deployment.cs trunk/Source/StructureMap.DeploymentTasks/DumbConfigMergeTask.cs trunk/Source/StructureMap.DeploymentTasks/ImportFamilyTask.cs trunk/Source/StructureMap.DeploymentTasks/RemoveAssemblyTask.cs trunk/Source/StructureMap.DeploymentTasks/SetOverrideTask.cs trunk/Source/StructureMap.DeploymentTasks/SubstitutionTask.cs trunk/Source/StructureMap.DeploymentTasks/Verification.cs trunk/Source/StructureMap.DeploymentTasks/Versioning/CheckVersionTask.cs trunk/Source/StructureMap.DeploymentTasks/Versioning/DeployedDirectory.cs trunk/Source/StructureMap.DeploymentTasks/Versioning/DeployedFile.cs trunk/Source/StructureMap.DeploymentTasks/Versioning/DotNetAssembly.cs trunk/Source/StructureMap.Diagnostics/AssemblyInfo.cs trunk/Source/StructureMap.Testing/AlternativeConfigurationTester.cs trunk/Source/StructureMap.Testing/AssemblyInfo.cs trunk/Source/StructureMap.Testing/Attributes/PluginFamilyAttributeTester.cs trunk/Source/StructureMap.Testing/AutoMocking/RhinoAutoMockerTester.cs trunk/Source/StructureMap.Testing/Caching/ExpirationTester.cs trunk/Source/StructureMap.Testing/Caching/FileModificationWatcherTester.cs trunk/Source/StructureMap.Testing/Caching/MockManagedCache.cs trunk/Source/StructureMap.Testing/Caching/StorageAndCacheItemTester.cs trunk/Source/StructureMap.Testing/Client/Controllers/ApplicationControllerTester.cs trunk/Source/StructureMap.Testing/Client/Controllers/TreeBuilderTester.cs trunk/Source/StructureMap.Testing/Client/Controllers/TreeNodeExpectation.cs trunk/Source/StructureMap.Testing/Client/GraphObjectNodeTester.cs trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserCollectionTester.cs trunk/Source/StructureMap.Testing/Configuration/ConfigurationParserTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/AddTypesTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ConstructorExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreateProfileTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InjectArrayTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptAllInstancesOfPluginTypeTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InterceptorTesting.cs trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ScanAssembliesTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DefaultInstanceNodeTester.cs trunk/Source/StructureMap.Testing/Configuration/DiagnosticGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/FamilyParserTester.cs trunk/Source/StructureMap.Testing/Configuration/IncludeTesting.cs trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs trunk/Source/StructureMap.Testing/Configuration/InstanceValidatorTester.cs trunk/Source/StructureMap.Testing/Configuration/MockGraphObject.cs trunk/Source/StructureMap.Testing/Configuration/NormalGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/PluginGraphReportTester.cs trunk/Source/StructureMap.Testing/Configuration/ShortcuttedInstanceNodeTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/FamilyTokenTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/GraphObjectTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/InstanceTokenTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/MockInterceptor.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/MockMementoSource.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/PluginTokenTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildArrayPropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildPropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/EnumerationPropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/PrimitivePropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/PropertyDefinitionTester.cs trunk/Source/StructureMap.Testing/ConstructorMementoTester.cs trunk/Source/StructureMap.Testing/Container/ArrayConstructorTester.cs trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs trunk/Source/StructureMap.Testing/Container/EmittingTester.cs trunk/Source/StructureMap.Testing/Container/ExceptionHandling/ExceptionTestRunner.cs trunk/Source/StructureMap.Testing/Container/ExceptionHandling/StructureMapExceptionTester.cs trunk/Source/StructureMap.Testing/Container/FillDependenciesTester.cs trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs trunk/Source/StructureMap.Testing/Container/ImplicitDefaultTest.cs trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs trunk/Source/StructureMap.Testing/Container/IntegratedTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/InteceptorChainBuilderTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/InterceptorLibraryTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/MockTypeInterceptor.cs trunk/Source/StructureMap.Testing/Container/Interceptors/SingletonInterceptorTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/ThreadLocalStorageInterceptorTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/TypeInterceptionTester.cs trunk/Source/StructureMap.Testing/Container/MockingTester.cs trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Container/SetterInjectionEmittingTester.cs trunk/Source/StructureMap.Testing/Container/Source/DirectoryXmlMementoSourceTester.cs trunk/Source/StructureMap.Testing/Container/Source/EmbeddedFolderXmlMementoSourceTester.cs trunk/Source/StructureMap.Testing/Container/Source/SingleEmbeddedXmlMementoSourceTester.cs trunk/Source/StructureMap.Testing/Container/Source/TemplatingTester.cs trunk/Source/StructureMap.Testing/Container/Source/XmlAttributeInstanceMementoTester.cs trunk/Source/StructureMap.Testing/Container/Source/XmlInstanceMementoTester.cs trunk/Source/StructureMap.Testing/Container/Source/XmlMementoSourceTester.cs trunk/Source/StructureMap.Testing/Container/Source/XmlTemplaterTester.cs trunk/Source/StructureMap.Testing/Container/TypeFindingTester.cs trunk/Source/StructureMap.Testing/DataAccess/CommandFactoryTester.cs trunk/Source/StructureMap.Testing/DataAccess/Commands/ParameterizedQueryFilterTester.cs trunk/Source/StructureMap.Testing/DataAccess/Commands/StoredProcedureCommandTester.cs trunk/Source/StructureMap.Testing/DataAccess/Commands/TemplatedQueryFilterTester.cs trunk/Source/StructureMap.Testing/DataAccess/Commands/TemplatedQueryTester.cs trunk/Source/StructureMap.Testing/DataAccess/DataSessionTester.cs trunk/Source/StructureMap.Testing/DataAccess/DataSetMapping/ReaderToColumnMapTester.cs trunk/Source/StructureMap.Testing/DataAccess/DataSetMapping/ReaderToTableMapperTester.cs trunk/Source/StructureMap.Testing/DataAccess/DataSetMapping/YesNoReaderToColumnMapTester.cs trunk/Source/StructureMap.Testing/DataAccess/ExecutionStates/AutoCommitExecutionStateTester.cs trunk/Source/StructureMap.Testing/DataAccess/ExecutionStates/TransactionalExecutionStateTester.cs trunk/Source/StructureMap.Testing/DataAccess/JSON/FieldTester.cs trunk/Source/StructureMap.Testing/DataAccess/JSON/PropertyTester.cs trunk/Source/StructureMap.Testing/DataAccess/MSSQL/MSSQLDatabaseEngineTester.cs trunk/Source/StructureMap.Testing/DataAccess/Parameterization/ParameterTemplateTester.cs trunk/Source/StructureMap.Testing/DataAccess/StubbedCommand.cs trunk/Source/StructureMap.Testing/DataAccess/StubbedReaderSource.cs trunk/Source/StructureMap.Testing/DataAccess/TemplatedCommandTester.cs trunk/Source/StructureMap.Testing/DataAccess/Tools/Mocks/CommandExpectationTester.cs trunk/Source/StructureMap.Testing/DataAccess/Tools/Mocks/MockCommandTester.cs trunk/Source/StructureMap.Testing/DataAccess/Tools/Mocks/MockReaderSourceTester.cs trunk/Source/StructureMap.Testing/DataAccess/Tools/Mocks/ParameterListTester.cs trunk/Source/StructureMap.Testing/DataAccess/Tools/TableDataReaderTester.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/GenericsIntegrationTester.cs trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs trunk/Source/StructureMap.Testing/Graph/GenericsPluginGraphTester.cs trunk/Source/StructureMap.Testing/Graph/InstanceTarget.cs trunk/Source/StructureMap.Testing/Graph/InterceptionChainTester.cs trunk/Source/StructureMap.Testing/Graph/OverrideGraphTester.cs trunk/Source/StructureMap.Testing/Graph/OverrideTester.cs trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs trunk/Source/StructureMap.Testing/Graph/PluginGraphTester.cs trunk/Source/StructureMap.Testing/Graph/PluginTester.cs trunk/Source/StructureMap.Testing/Graph/SetterInjectionTester.cs trunk/Source/StructureMap.Testing/Graph/TypePathTester.cs trunk/Source/StructureMap.Testing/ImplicitPluginFromPluggedTypeAttributeTester.cs trunk/Source/StructureMap.Testing/InstanceMementoTester.cs trunk/Source/StructureMap.Testing/ObjectFactoryTester.cs trunk/Source/StructureMap.Testing/ObjectMother.cs trunk/Source/StructureMap.Testing/StructureMapConfigCreator.cs trunk/Source/StructureMap.Testing/StructureMapConfigurationTester.cs trunk/Source/StructureMap.Testing.DeploymentTasks/DeploymentExecutorTester.cs trunk/Source/StructureMap.Testing.DeploymentTasks/DeploymentTaskAcceptanceTests.cs trunk/Source/StructureMap.Testing.DeploymentTasks/DeploymentTester.cs trunk/Source/StructureMap.Testing.DeploymentTasks/SetOverrideTaskTester.cs trunk/Source/StructureMap.Testing.DeploymentTasks/SubstitutionTaskTester.cs trunk/Source/StructureMap.Testing.DeploymentTasks/Versioning/DeployedFileTester.cs trunk/Source/StructureMap.Testing.DeploymentTasks/Versioning/DotNetAssemblyTester.cs trunk/Source/StructureMap.Testing.GenericWidgets/Properties/AssemblyInfo.cs trunk/Source/StructureMap.Testing.GenericWidgets/Widgets.cs trunk/Source/StructureMap.Testing.Widget/AssemblyInfo.cs trunk/Source/StructureMap.Testing.Widget/Columns.cs trunk/Source/StructureMap.Testing.Widget/Hierarchy.cs trunk/Source/StructureMap.Testing.Widget/IWidget.cs trunk/Source/StructureMap.Testing.Widget/Rule.cs trunk/Source/StructureMap.Testing.Widget2/AssemblyInfo.cs trunk/Source/StructureMap.Testing.Widget2/EnumerationCheck.cs trunk/Source/StructureMap.Testing.Widget3/AssemblyInfo.cs trunk/Source/StructureMap.Testing.Widget3/Gateways.cs trunk/Source/StructureMap.Testing.Widget4/AssemblyInfo.cs trunk/Source/StructureMap.Testing.Widget4/Strategy.cs trunk/Source/StructureMap.Testing.Widget5/AssemblyInfo.cs trunk/Source/StructureMap.Testing.Widget5/BasicGridColumn.cs trunk/Source/StructureMap.Testing.Widget5/CannotBeAutoFilledGridColumn.cs trunk/Source/StructureMap.Testing.Widget5/LinkGridColumn.cs trunk/Source/StructureMap.Testing.Widget5/OtherGridColumn.cs trunk/Source/StructureMapExplorer/AssemblyInfo.cs Modified: trunk/Source/StructureMap/AssemblyInfo.cs =================================================================== --- trunk/Source/StructureMap/AssemblyInfo.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/AssemblyInfo.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -1,8 +1,10 @@ using System.Reflection; + // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // + [assembly : AssemblyTitle("StructureMap")] [assembly : AssemblyDescription("Main Library")] \ No newline at end of file Modified: trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs =================================================================== --- trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Attributes/PluginFamilyAttribute.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -12,8 +12,8 @@ public class PluginFamilyAttribute : Attribute { private string _default = string.Empty; + private InstanceScope _scope = InstanceScope.PerRequest; private Type _source = null; - private InstanceScope _scope = InstanceScope.PerRequest; public PluginFamilyAttribute() { Modified: trunk/Source/StructureMap/Caching/CacheItem.cs =================================================================== --- trunk/Source/StructureMap/Caching/CacheItem.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/CacheItem.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -5,12 +5,12 @@ { public abstract class CacheItem : ICacheItem { + private int _accesses; + private DateTime _created; + private bool _isEmpty = false; private object _key; private DateTime _lastAccessed; - private DateTime _created; - private int _accesses; private ReaderWriterLock rwl; - private bool _isEmpty = false; public CacheItem(object Key) { @@ -20,6 +20,13 @@ reset(); } + public bool IsEmpty + { + get { return _isEmpty; } + } + + #region ICacheItem Members + public object Key { get { return _key; } @@ -40,23 +47,6 @@ get { return _accesses; } } - - private void reset() - { - _accesses = 0; - _lastAccessed = _created = DateTime.Now; - } - - private void markAccess() - { - lock (this) - { - _accesses++; - _lastAccessed = DateTime.Now; - } - } - - public object Value { get @@ -77,12 +67,24 @@ } } - public bool IsEmpty + #endregion + + private void reset() { - get { return _isEmpty; } + _accesses = 0; + _lastAccessed = _created = DateTime.Now; } + private void markAccess() + { + lock (this) + { + _accesses++; + _lastAccessed = DateTime.Now; + } + } + protected abstract object getValue(); protected abstract void setValue(object Value); } Modified: trunk/Source/StructureMap/Caching/CacheManager.cs =================================================================== --- trunk/Source/StructureMap/Caching/CacheManager.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/CacheManager.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -17,11 +17,11 @@ #endregion + private EventDispatcher _clearAllDispatcher; + private bool _continuePolling = true; private HybridDictionary _dispatchers; - private bool _continuePolling = true; private bool _isPolling = false; private int _PollingTimeInMinutes; - private EventDispatcher _clearAllDispatcher; private EventDispatcher _pruneAllDispatcher; @@ -91,8 +91,27 @@ _clearAllDispatcher.Dispatch(); } + public void DispatchEvent(string EventName) + { + if (_dispatchers.Contains(EventName)) + { + EventDispatcher _dispatcher = (EventDispatcher) _dispatchers[EventName]; + _dispatcher.Dispatch(); + } + } + #region polling + public bool IsPolling + { + get { return _isPolling; } + } + + public int PollingTimeInMinutes + { + get { return _PollingTimeInMinutes; } + } + public void StartPolling() { if (!IsPolling) @@ -108,17 +127,7 @@ _continuePolling = false; } - public bool IsPolling - { - get { return _isPolling; } - } - public int PollingTimeInMinutes - { - get { return _PollingTimeInMinutes; } - } - - private void poll() { while (_continuePolling) @@ -135,14 +144,5 @@ } #endregion - - public void DispatchEvent(string EventName) - { - if (_dispatchers.Contains(EventName)) - { - EventDispatcher _dispatcher = (EventDispatcher) _dispatchers[EventName]; - _dispatcher.Dispatch(); - } - } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Caching/CloneStorageStrategy.cs =================================================================== --- trunk/Source/StructureMap/Caching/CloneStorageStrategy.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/CloneStorageStrategy.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -2,9 +2,13 @@ { public class CloneStorageStrategy : IStorageStrategy { + #region IStorageStrategy Members + public ICacheItem BuildCacheItem(object Key) { return new CloneCacheItem(Key); } + + #endregion } } \ No newline at end of file Modified: trunk/Source/StructureMap/Caching/Expirations/AbsoluteTimeExpirationPolicy.cs =================================================================== --- trunk/Source/StructureMap/Caching/Expirations/AbsoluteTimeExpirationPolicy.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/Expirations/AbsoluteTimeExpirationPolicy.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -5,8 +5,8 @@ [Pluggable("AbsoluteTime")] public class AbsoluteTimeExpirationPolicy : IExpirationPolicy { + private DateTime _currentTime; private long _ticks; - private DateTime _currentTime; public AbsoluteTimeExpirationPolicy(int minutes) { Modified: trunk/Source/StructureMap/Caching/Expirations/SlidingTimeExpirationPolicy.cs =================================================================== --- trunk/Source/StructureMap/Caching/Expirations/SlidingTimeExpirationPolicy.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/Expirations/SlidingTimeExpirationPolicy.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -5,8 +5,8 @@ [Pluggable("SlidingTime")] public class SlidingTimeExpirationPolicy : IExpirationPolicy { + private DateTime _currentTime; private long _ticks; - private DateTime _currentTime; public SlidingTimeExpirationPolicy(int minutes) { Modified: trunk/Source/StructureMap/Caching/FileModificationWatcher.cs =================================================================== --- trunk/Source/StructureMap/Caching/FileModificationWatcher.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/FileModificationWatcher.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -4,9 +4,9 @@ { public class FileModificationWatcher : ClearEventDispatcher { + private string _fullPath; private string _key; private FileSystemWatcher _watcher; - private string _fullPath; public FileModificationWatcher(string FilePath) : base(SubjectNameFromFilePath(FilePath)) Modified: trunk/Source/StructureMap/Caching/LazyCache.cs =================================================================== --- trunk/Source/StructureMap/Caching/LazyCache.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/LazyCache.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -6,12 +6,12 @@ { public class LazyCache : IManagedCache { + private IExpirationPolicy[] _expirations; + private HybridDictionary _items; private string _name; - private IExpirationPolicy[] _expirations; + private bool _refillOnExpiration; private IValueSource _source; private IStorageStrategy _storage; - private HybridDictionary _items; - private bool _refillOnExpiration; public LazyCache(string CacheName, IExpirationPolicy[] Expirations, IValueSource Source, @@ -27,6 +27,52 @@ CacheManager.CurrentManager.ManageCache(this); } + [IndexerName("Value")] + public object this[object key] + { + get + { + if (!_items.Contains(key)) + { + lock (_items.SyncRoot) + { + if (!_items.Contains(key)) + { + ICacheItem newItem = _storage.BuildCacheItem(key); + newItem.Value = _source.GetValue(key); + _items.Add(key, newItem); + } + } + } + + ICacheItem item = (ICacheItem) _items[key]; + return item.Value; + } + set + { + ICacheItem item = null; + + if (!_items.Contains(key)) + { + lock (_items.SyncRoot) + { + if (!_items.Contains(key)) + { + item = _storage.BuildCacheItem(key); + _items.Add(key, item); + } + } + } + + if (item == null) + { + item = (ICacheItem) _items[key]; + } + + item.Value = value; + } + } + #region IManagedCache Members public string CacheName @@ -61,6 +107,13 @@ } } + public void AddWatches(CacheManager Manager) + { + // TODO: Add LazyCache.AddWatches implementation + } + + #endregion + private void expire(ICacheItem item) { if (_refillOnExpiration) @@ -73,59 +126,6 @@ } } - public void AddWatches(CacheManager Manager) - { - // TODO: Add LazyCache.AddWatches implementation - } - - #endregion - // TODO -- optimize this. Go to record level locking - - [IndexerName("Value")] - public object this[object key] - { - get - { - if (!_items.Contains(key)) - { - lock (_items.SyncRoot) - { - if (!_items.Contains(key)) - { - ICacheItem newItem = _storage.BuildCacheItem(key); - newItem.Value = _source.GetValue(key); - _items.Add(key, newItem); - } - } - } - - ICacheItem item = (ICacheItem) _items[key]; - return item.Value; - } - set - { - ICacheItem item = null; - - if (!_items.Contains(key)) - { - lock (_items.SyncRoot) - { - if (!_items.Contains(key)) - { - item = _storage.BuildCacheItem(key); - _items.Add(key, item); - } - } - } - - if (item == null) - { - item = (ICacheItem) _items[key]; - } - - item.Value = value; - } - } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Caching/SerializationStorageStrategy.cs =================================================================== --- trunk/Source/StructureMap/Caching/SerializationStorageStrategy.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/SerializationStorageStrategy.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -2,9 +2,13 @@ { public class SerializationStorageStrategy : IStorageStrategy { + #region IStorageStrategy Members + public ICacheItem BuildCacheItem(object Key) { return new SerializationCacheItem(Key); } + + #endregion } } \ No newline at end of file Modified: trunk/Source/StructureMap/Caching/SharedStorageStrategy.cs =================================================================== --- trunk/Source/StructureMap/Caching/SharedStorageStrategy.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Caching/SharedStorageStrategy.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -2,9 +2,13 @@ { public class SharedStorageStrategy : IStorageStrategy { + #region IStorageStrategy Members + public ICacheItem BuildCacheItem(object Key) { return new SharedCacheItem(Key); } + + #endregion } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/ConfigurationConstants.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationConstants.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/ConfigurationConstants.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -2,46 +2,52 @@ { public class ConfigurationConstants { - private ConfigurationConstants() - { - } + public const string CONFIGURED_DEFAULT_KEY_CANNOT_BE_FOUND = + "The default instance key configured for this PluginFamily cannot be found"; + public const string COULD_NOT_CREATE_INSTANCE = "Cannot create the configured InstanceMemento"; + public const string COULD_NOT_CREATE_MEMENTO_SOURCE = "Could not create the externally configured MementoSource"; + public const string COULD_NOT_LOAD_ASSEMBLY = "Could not load Assembly into target AppDomain"; public const string COULD_NOT_LOAD_TYPE = "Could not load Type into target AppDomain"; - public const string PLUGIN_IS_MISSING_CONCRETE_KEY = "Plugin definition is missing a value for ConcreteKey"; - public const string INVALID_SETTER = "Requested Setter property does not exist"; - public const string MEMENTO_PROPERTY_IS_MISSING = "Property is missing from the InstanceMemento configuration"; + + public const string FATAL_ERROR = + "A fatal error in configuration is preventing StructureMap from functioning correctly"; + public const string INVALID_ENUMERATION_VALUE = "Property value is not a valid name for this Enumeration type"; + public const string INVALID_PLUGIN = "Requested ConcreteKey for this PluginType cannot be found"; + public const string INVALID_PLUGIN_FAMILY = "The PluginFamily is not configured in StructureMap"; + public const string INVALID_PROPERTY_CAST = "Property value in the configured InstanceMemento could not be casted to the target type"; - public const string INVALID_PLUGIN = "Requested ConcreteKey for this PluginType cannot be found"; - public const string MISSING_INSTANCE_KEY = "InstanceKey is required"; - public const string MISSING_CHILD = "Child memento is not defined"; - public const string INVALID_PLUGIN_FAMILY = "The PluginFamily is not configured in StructureMap"; - public const string VALIDATION_METHOD_FAILURE = "A Validation Method Failed"; - public const string COULD_NOT_CREATE_INSTANCE = "Cannot create the configured InstanceMemento"; - public const string NO_DEFAULT_INSTANCE_CONFIGURED = "No default instance is configured for this PluginFamily"; - public const string NO_MATCHING_INSTANCE_CONFIGURED = "No matching instance is configured for this PluginFamily"; - public const string COULD_NOT_CREATE_MEMENTO_SOURCE = "Could not create the externally configured MementoSource"; + public const string INVALID_SETTER = "Requested Setter property does not exist"; + public const string MEMENTO_PROPERTY_IS_MISSING = "Property is missing from the InstanceMemento configuration"; public const string MEMENTO_SOURCE_CANNOT_RETRIEVE = "The configured MementoSource cannot retrieve InstanceMemento objects"; - public const string CONFIGURED_DEFAULT_KEY_CANNOT_BE_FOUND = - "The default instance key configured for this PluginFamily cannot be found"; + public const string MISSING_CHILD = "Child memento is not defined"; + public const string MISSING_INSTANCE_KEY = "InstanceKey is required"; + public const string MISSING_TEMPLATE_VALUE = "A required value for a Templated InstanceMemento is missing"; - public const string PLUGIN_FAMILY_CANNOT_BE_FOUND_FOR_INSTANCE = - "No matching PluginFamily for the embedded memento in the <Instances> node"; + public const string NO_DEFAULT_INSTANCE_CONFIGURED = "No default instance is configured for this PluginFamily"; + public const string NO_MATCHING_INSTANCE_CONFIGURED = "No matching instance is configured for this PluginFamily"; public const string PLUGIN_CANNOT_READ_CONSTRUCTOR_PROPERTIES = "There was an error trying to determine the constructor arguments for a Plugin. Check for missing dependencies of the concrete type."; - public const string FATAL_ERROR = - "A fatal error in configuration is preventing StructureMap from functioning correctly"; + public const string PLUGIN_FAMILY_CANNOT_BE_FOUND_FOR_INSTANCE = + "No matching PluginFamily for the embedded memento in the <Instances> node"; - public const string MISSING_TEMPLATE_VALUE = "A required value for a Templated InstanceMemento is missing"; + public const string PLUGIN_IS_MISSING_CONCRETE_KEY = "Plugin definition is missing a value for ConcreteKey"; + public const string UNKNOWN_PLUGIN_PROBLEM = "Exception occured while attaching a Plugin to a PluginFamily"; + public const string VALIDATION_METHOD_FAILURE = "A Validation Method Failed"; + + private ConfigurationConstants() + { + } } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/ConfigurationParser.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/ConfigurationParser.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -94,8 +94,8 @@ #endregion + private readonly XmlMementoCreator _mementoCreator; private readonly XmlNode _structureMapNode; - private readonly XmlMementoCreator _mementoCreator; public ConfigurationParser(XmlNode structureMapNode) { Modified: trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs =================================================================== --- trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/ConfigurationParserCollection.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -9,10 +9,16 @@ public class ConfigurationParserCollection { + private List<FetchNodeDelegate> _fetchers = new List<FetchNodeDelegate>(); + private List<string> _otherFiles = new List<string>(); private bool _useDefaultFile = true; - private List<string> _otherFiles = new List<string>(); - private List<FetchNodeDelegate> _fetchers = new List<FetchNodeDelegate>(); + public bool UseDefaultFile + { + get { return _useDefaultFile; } + set { _useDefaultFile = value; } + } + public ConfigurationParser[] GetParsers() { List<ConfigurationParser> list = new List<ConfigurationParser>(); @@ -58,12 +64,6 @@ list.AddRange(parsers); } - public bool UseDefaultFile - { - get { return _useDefaultFile; } - set { _useDefaultFile = value; } - } - public void IncludeFile(string filename) { _otherFiles.Add(filename); Modified: trunk/Source/StructureMap/Configuration/DSL/ExpressionValidator.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ExpressionValidator.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/ExpressionValidator.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -10,6 +10,7 @@ return new ValidateExpression(pluggedType); } + #region Nested type: ValidateExpression public class ValidateExpression { @@ -31,5 +32,7 @@ } } } + + #endregion } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -6,8 +6,8 @@ { public class ChildArrayExpression<PLUGINTYPE> : IExpression { + private readonly MemoryInstanceMemento _memento; private readonly InstanceExpression _parent; - private readonly MemoryInstanceMemento _memento; private readonly string _propertyName; private IMementoBuilder[] _builders; private Type _pluginType = typeof (PLUGINTYPE); @@ -21,6 +21,8 @@ _pluginType = typeof (PLUGINTYPE).GetElementType(); } + #region IExpression Members + void IExpression.Configure(PluginGraph graph) { PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); @@ -34,6 +36,8 @@ _memento.AddChildArray(_propertyName, childMementos); } + #endregion + private InstanceMemento processMementoBuilder(IMementoBuilder builder, PluginFamily family, PluginGraph graph) { builder.ValidatePluggability(_pluginType); Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -14,9 +14,9 @@ private readonly InstanceExpression _instance; private readonly MemoryInstanceMemento _memento; private readonly string _propertyName; + private IMementoBuilder _builder; + private List<IExpression> _children = new List<IExpression>(); private Type _childType; - private List<IExpression> _children = new List<IExpression>(); - private IMementoBuilder _builder; public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName) @@ -33,6 +33,35 @@ _childType = childType; } + internal Type ChildType + { + set { _childType = value; } + } + + #region IExpression Members + + void IExpression.Configure(PluginGraph graph) + { + if (_childType == null) + { + return; + } + + PluginFamily family = graph.LocateOrCreateFamilyForType(_childType); + if (_builder != null) + { + InstanceMemento childMemento = _builder.BuildMemento(family); + _memento.AddChild(_propertyName, childMemento); + } + + foreach (IExpression child in _children) + { + child.Configure(graph); + } + } + + #endregion + /// <summary> /// Use a previously configured and named instance for the child /// </summary> @@ -67,31 +96,6 @@ } - void IExpression.Configure(PluginGraph graph) - { - if (_childType == null) - { - return; - } - - PluginFamily family = graph.LocateOrCreateFamilyForType(_childType); - if (_builder != null) - { - InstanceMemento childMemento = _builder.BuildMemento(family); - _memento.AddChild(_propertyName, childMemento); - } - - foreach (IExpression child in _children) - { - child.Configure(graph); - } - } - - internal Type ChildType - { - set { _childType = value; } - } - /// <summary> /// Registers a configured instance to use as the argument to the parent's /// constructor Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using StructureMap.Attributes; -using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; @@ -171,7 +170,7 @@ public CreatePluginFamilyExpression<PLUGINTYPE> InterceptConstructionWith(InstanceFactoryInterceptor interceptor) { - _alterations.Add(delegate(PluginFamily family){family.InterceptionChain.AddInterceptor(interceptor);}); + _alterations.Add(delegate(PluginFamily family) { family.InterceptionChain.AddInterceptor(interceptor); }); return this; } } Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -1,5 +1,4 @@ using System; -using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; namespace StructureMap.Configuration.DSL.Expressions @@ -9,8 +8,8 @@ /// </summary> public class InstanceDefaultExpression { - private readonly Type _pluginType; private readonly ProfileExpression _parent; + private readonly Type _pluginType; private string _instanceKey = string.Empty; private IMementoBuilder _mementoBuilder; Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -1,5 +1,4 @@ using System; -using StructureMap.Configuration.DSL.Expressions; using StructureMap.Configuration.Mementos; using StructureMap.Graph; @@ -10,8 +9,8 @@ /// </summary> public class InstanceExpression : MementoBuilder<InstanceExpression> { + private MemoryInstanceMemento _memento; private Type _pluggedType; - private MemoryInstanceMemento _memento; public InstanceExpression(Type pluginType) : base(pluginType) { @@ -23,12 +22,7 @@ get { return _pluggedType; } } - protected override void buildMemento() - { - _memento = new MemoryInstanceMemento(); - } - protected override InstanceMemento memento { get { return _memento; } @@ -39,6 +33,11 @@ get { return this; } } + protected override void buildMemento() + { + _memento = new MemoryInstanceMemento(); + } + protected override void configureMemento(PluginFamily family) { Plugin plugin = _pluggedType == null @@ -128,6 +127,35 @@ return new InstanceTypeExpression(this); } + public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>() + { + validateTypeIsArray<PLUGINTYPE>(); + + string propertyName = findPropertyName<PLUGINTYPE>(); + return ChildArray<PLUGINTYPE>(propertyName); + } + + public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>(string propertyName) + { + validateTypeIsArray<PLUGINTYPE>(); + + ChildArrayExpression<PLUGINTYPE> expression = + new ChildArrayExpression<PLUGINTYPE>(this, _memento, propertyName); + addChildExpression(expression); + + return expression; + } + + private static void validateTypeIsArray<PLUGINTYPE>() + { + if (!typeof (PLUGINTYPE).IsArray) + { + throw new StructureMapException(307); + } + } + + #region Nested type: InstanceTypeExpression + /// <summary> /// Helper class to capture the actual concrete type of an Instance /// </summary> @@ -163,31 +191,6 @@ } } - public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>() - { - validateTypeIsArray<PLUGINTYPE>(); - - string propertyName = findPropertyName<PLUGINTYPE>(); - return ChildArray<PLUGINTYPE>(propertyName); - } - - public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>(string propertyName) - { - validateTypeIsArray<PLUGINTYPE>(); - - ChildArrayExpression<PLUGINTYPE> expression = - new ChildArrayExpression<PLUGINTYPE>(this, _memento, propertyName); - addChildExpression(expression); - - return expression; - } - - private static void validateTypeIsArray<PLUGINTYPE>() - { - if (!typeof (PLUGINTYPE).IsArray) - { - throw new StructureMapException(307); - } - } + #endregion } } \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Interceptors; @@ -19,6 +18,23 @@ memento.InstanceKey = Guid.NewGuid().ToString(); } + protected abstract InstanceMemento memento { get; } + + protected abstract T thisInstance { get; } + + public string InstanceKey + { + get { return memento.InstanceKey; } + set { memento.InstanceKey = value; } + } + + internal Type PluginType + { + get { return _pluginType; } + } + + #region IExpression Members + void IExpression.Configure(PluginGraph graph) { validate(); @@ -38,10 +54,30 @@ } } - protected abstract InstanceMemento memento { get; } + #endregion - protected abstract T thisInstance { get; } + #region IMementoBuilder Members + InstanceMemento IMementoBuilder.BuildMemento(PluginFamily family) + { + return buildMementoFromFamily(family); + } + + InstanceMemento IMementoBuilder.BuildMemento(PluginGraph graph) + { + PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); + return buildMementoFromFamily(family); + } + + public void SetInstanceName(string instanceKey) + { + _instanceKey = instanceKey; + } + + public abstract void ValidatePluggability(Type pluginType); + + #endregion + protected abstract void configureMemento(PluginFamily family); protected abstract void validate(); @@ -68,24 +104,8 @@ return thisInstance; } - public string InstanceKey - { - get { return memento.InstanceKey; } - set { memento.InstanceKey = value; } - } - - internal Type PluginType - { - get { return _pluginType; } - } - protected abstract void buildMemento(); - InstanceMemento IMementoBuilder.BuildMemento(PluginFamily family) - { - return buildMementoFromFamily(family); - } - private InstanceMemento buildMementoFromFamily(PluginFamily family) { validate(); @@ -94,19 +114,6 @@ } - InstanceMemento IMementoBuilder.BuildMemento(PluginGraph graph) - { - PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); - return buildMementoFromFamily(family); - } - - public void SetInstanceName(string instanceKey) - { - _instanceKey = instanceKey; - } - - public abstract void ValidatePluggability(Type pluginType); - protected void addChildExpression(IExpression expression) { _children.Add(expression); Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs 2008-01-15 15:15:50 UTC (rev 56) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs 2008-01-15 15:56:14 UTC (rev 57) @@ -1,5 +1,4 @@ using System.Collections.Generic; -using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; namespace StructureMap.Configuration.DSL.Expressions @@ -9,14 +8,16 @@ /// </summary> public class ProfileExpression : IExpression { + private readonly List<InstanceDefaultExpression> _defaults = new List<Instanc... [truncated message content] |
From: <jer...@us...> - 2008-01-15 15:15:52
|
Revision: 56 http://structuremap.svn.sourceforge.net/structuremap/?rev=56&view=rev Author: jeremydmiller Date: 2008-01-15 07:15:50 -0800 (Tue, 15 Jan 2008) Log Message: ----------- added quite a bit of stuff to the fluent interface for interception, scanning assemblies, a shortcut to add a type as something other than the default, add an assembly by name Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/Graph/AssemblyGraph.cs trunk/Source/StructureMap/Graph/Plugin.cs trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/Graph/PluginGraph.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ScanAssembliesTester.cs trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs trunk/Source/StructureMap.Testing/Graph/PluginTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj Added Paths: ----------- trunk/Source/StructureMap/Delegates.cs trunk/Source/StructureMap.Testing/Configuration/DSL/AddTypesTester.cs trunk/Source/StructureMap.Testing/Container/TypeFindingTester.cs Removed Paths: ------------- trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs trunk/Source/StructureMap/Configuration/DSL/IMementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/InstanceDefaultExpression.cs trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/LiteralExpression.cs trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs trunk/Source/StructureMap/Configuration/UserControlMemento.cs Deleted: trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,50 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - public class ChildArrayExpression<PLUGINTYPE> : IExpression - { - private readonly InstanceExpression _parent; - private readonly MemoryInstanceMemento _memento; - private readonly string _propertyName; - private IMementoBuilder[] _builders; - private Type _pluginType = typeof (PLUGINTYPE); - - public ChildArrayExpression(InstanceExpression parent, MemoryInstanceMemento memento, string propertyName) - { - _parent = parent; - _memento = memento; - _propertyName = propertyName; - - _pluginType = typeof (PLUGINTYPE).GetElementType(); - } - - void IExpression.Configure(PluginGraph graph) - { - PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); - InstanceMemento[] childMementos = new InstanceMemento[_builders.Length]; - for (int i = 0; i < _builders.Length; i++) - { - InstanceMemento memento = processMementoBuilder(_builders[i], family, graph); - childMementos[i] = memento; - } - - _memento.AddChildArray(_propertyName, childMementos); - } - - private InstanceMemento processMementoBuilder(IMementoBuilder builder, PluginFamily family, PluginGraph graph) - { - builder.ValidatePluggability(_pluginType); - builder.Configure(graph); - return builder.BuildMemento(family); - } - - public InstanceExpression Contains(params IMementoBuilder[] builders) - { - _builders = builders; - - return _parent; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,115 +0,0 @@ -using System; -using System.Collections.Generic; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Part of the Fluent Interface, represents a nonprimitive argument to a - /// constructure function - /// </summary> - public class ChildInstanceExpression : IExpression - { - private readonly InstanceExpression _instance; - private readonly MemoryInstanceMemento _memento; - private readonly string _propertyName; - private Type _childType; - private List<IExpression> _children = new List<IExpression>(); - private IMementoBuilder _builder; - - - public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName) - { - _instance = instance; - _memento = memento; - _propertyName = propertyName; - } - - public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName, - Type childType) - : this(instance, memento, propertyName) - { - _childType = childType; - } - - /// <summary> - /// Use a previously configured and named instance for the child - /// </summary> - /// <param name="instanceKey"></param> - /// <returns></returns> - public InstanceExpression IsNamedInstance(string instanceKey) - { - MemoryInstanceMemento child = MemoryInstanceMemento.CreateReferencedInstanceMemento(instanceKey); - _memento.AddChild(_propertyName, child); - - return _instance; - } - - /// <summary> - /// Start the definition of a child instance by defining the concrete type - /// </summary> - /// <typeparam name="T"></typeparam> - /// <returns></returns> - public InstanceExpression IsConcreteType<T>() - { - Type pluggedType = typeof (T); - ExpressionValidator.ValidatePluggabilityOf(pluggedType).IntoPluginType(_childType); - - - InstanceExpression child = new InstanceExpression(_childType); - child.TypeExpression().UsingConcreteType<T>(); - _children.Add(child); - - _builder = child; - - return _instance; - } - - - void IExpression.Configure(PluginGraph graph) - { - if (_childType == null) - { - return; - } - - PluginFamily family = graph.LocateOrCreateFamilyForType(_childType); - if (_builder != null) - { - InstanceMemento childMemento = _builder.BuildMemento(family); - _memento.AddChild(_propertyName, childMemento); - } - - foreach (IExpression child in _children) - { - child.Configure(graph); - } - } - - internal Type ChildType - { - set { _childType = value; } - } - - /// <summary> - /// Registers a configured instance to use as the argument to the parent's - /// constructor - /// </summary> - /// <param name="child"></param> - /// <returns></returns> - public InstanceExpression Is(InstanceExpression child) - { - if (child.PluggedType != null && _childType != null) - { - ExpressionValidator.ValidatePluggabilityOf(child.PluggedType).IntoPluginType(_childType); - } - - _children.Add(child); - MemoryInstanceMemento childMemento = - MemoryInstanceMemento.CreateReferencedInstanceMemento(child.InstanceKey); - _memento.AddChild(_propertyName, childMemento); - - return _instance; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,49 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - public class ConstructorExpression<PLUGINTYPE> : MementoBuilder<ConstructorExpression<PLUGINTYPE>> - { - private ConstructorMemento<PLUGINTYPE> _memento; - - public ConstructorExpression(BuildObjectDelegate<PLUGINTYPE> builder) - : base(typeof (PLUGINTYPE)) - { - _memento.Builder = builder; - } - - - protected override InstanceMemento memento - { - get { return _memento; } - } - - protected override ConstructorExpression<PLUGINTYPE> thisInstance - { - get { return this; } - } - - protected override void configureMemento(PluginFamily family) - { - } - - protected override void validate() - { - } - - protected override void buildMemento() - { - _memento = new ConstructorMemento<PLUGINTYPE>(); - } - - public override void ValidatePluggability(Type pluginType) - { - if (!pluginType.Equals(typeof (PLUGINTYPE))) - { - throw new StructureMapException(306, - typeof (PLUGINTYPE).FullName, pluginType.FullName); - } - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,148 +0,0 @@ -using System; -using System.Collections.Generic; -using StructureMap.Attributes; -using StructureMap.Graph; -using StructureMap.Interceptors; - -namespace StructureMap.Configuration.DSL -{ - public delegate void AlterPluginFamilyDelegate(PluginFamily family); - - /// <summary> - /// Represents the parameters for creating instances of a given Type - /// </summary> - public class CreatePluginFamilyExpression<PLUGINTYPE> : IExpression - { - private Type _pluginType; - private List<AlterPluginFamilyDelegate> _alterations = new List<AlterPluginFamilyDelegate>(); - private InstanceScope _scope = InstanceScope.PerRequest; - private List<IExpression> _children = new List<IExpression>(); - - public CreatePluginFamilyExpression() - { - _pluginType = typeof (PLUGINTYPE); - } - - void IExpression.Configure(PluginGraph graph) - { - PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); - InterceptorChainBuilder builder = new InterceptorChainBuilder(); - family.InterceptionChain = builder.Build(_scope); - - foreach (IExpression child in _children) - { - child.Configure(graph); - } - - foreach (AlterPluginFamilyDelegate alteration in _alterations) - { - alteration(family); - } - - graph.PluginFamilies.Add(family); - - AssemblyGraph assembly = new AssemblyGraph(_pluginType.Assembly); - graph.Assemblies.Add(assembly); - } - - /// <summary> - /// Sets the default instance of a Type to the definition represented by builder - /// </summary> - /// <param name="builder"></param> - /// <returns></returns> - public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIs(IMementoBuilder builder) - { - builder.ValidatePluggability(_pluginType); - - _children.Add(builder); - _alterations.Add(delegate(PluginFamily family) - { - InstanceMemento memento = builder.BuildMemento(family); - family.Source.AddExternalMemento(memento); - family.DefaultInstanceKey = memento.InstanceKey; - }); - - return this; - } - - public CreatePluginFamilyExpression<PLUGINTYPE> AddInstance(IMementoBuilder builder) - { - builder.ValidatePluggability(_pluginType); - - _children.Add(builder); - _alterations.Add(delegate(PluginFamily family) - { - InstanceMemento memento = builder.BuildMemento(family); - family.Source.AddExternalMemento(memento); - }); - - return this; - } - - /// <summary> - /// Convenience method that sets the default concrete type of the PluginType. Type T - /// can only accept types that do not have any primitive constructor arguments. - /// StructureMap has to know how to construct all of the constructor argument types. - /// </summary> - /// <typeparam name="CONCRETETYPE"></typeparam> - /// <returns></returns> - public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIsConcreteType<CONCRETETYPE>() - where CONCRETETYPE : PLUGINTYPE - { - ExpressionValidator.ValidatePluggabilityOf(typeof (CONCRETETYPE)).IntoPluginType(_pluginType); - - _alterations.Add(delegate(PluginFamily family) - { - Plugin plugin = family.Plugins.FindOrCreate(typeof (CONCRETETYPE)); - family.DefaultInstanceKey = plugin.ConcreteKey; - }); - - return this; - } - - /// <summary> - /// Sets the object creation of the instances of the PluginType. For example: PerRequest, - /// Singleton, ThreadLocal, HttpContext, or Hybrid - /// </summary> - /// <param name="scope"></param> - /// <returns></returns> - public CreatePluginFamilyExpression<PLUGINTYPE> CacheBy(InstanceScope scope) - { - _alterations.Add(delegate(PluginFamily family) - { - InterceptorChainBuilder builder = new InterceptorChainBuilder(); - family.InterceptionChain = builder.Build(scope); - }); - - return this; - } - - /// <summary> - /// Convenience method to mark a PluginFamily as a Singleton - /// </summary> - /// <returns></returns> - public CreatePluginFamilyExpression<PLUGINTYPE> AsSingletons() - { - _alterations.Add( - delegate(PluginFamily family) { family.InterceptionChain.AddInterceptor(new SingletonInterceptor()); }); - return this; - } - - - public CreatePluginFamilyExpression<PLUGINTYPE> OnCreation(StartupHandler<PLUGINTYPE> handler) - { - _alterations.Add( - delegate(PluginFamily family) { family.InstanceInterceptor = new StartupInterceptor<PLUGINTYPE>(handler); }); - - return this; - } - - public CreatePluginFamilyExpression<PLUGINTYPE> EnrichWith(EnrichmentHandler<PLUGINTYPE> handler) - { - _alterations.Add( - delegate(PluginFamily family) { family.InstanceInterceptor = new EnrichmentInterceptor<PLUGINTYPE>(handler); }); - - return this; - } - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using StructureMap.Attributes; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; @@ -13,16 +14,18 @@ /// </summary> public class CreatePluginFamilyExpression<PLUGINTYPE> : IExpression { + private readonly List<AlterPluginFamilyDelegate> _alterations = new List<AlterPluginFamilyDelegate>(); + private readonly List<IExpression> _children = new List<IExpression>(); private readonly Type _pluginType; - private readonly List<AlterPluginFamilyDelegate> _alterations = new List<AlterPluginFamilyDelegate>(); private readonly InstanceScope _scope = InstanceScope.PerRequest; - private readonly List<IExpression> _children = new List<IExpression>(); public CreatePluginFamilyExpression() { _pluginType = typeof (PLUGINTYPE); } + #region IExpression Members + void IExpression.Configure(PluginGraph graph) { PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); @@ -45,6 +48,8 @@ graph.Assemblies.Add(assembly); } + #endregion + /// <summary> /// Sets the default instance of a Type to the definition represented by builder /// </summary> @@ -144,5 +149,30 @@ return this; } + + public CreatePluginFamilyExpression<PLUGINTYPE> AddConcreteType<CONCRETETYPE>() + { + return AddConcreteType<CONCRETETYPE>(Guid.NewGuid().ToString()); + } + + public CreatePluginFamilyExpression<PLUGINTYPE> AddConcreteType<CONCRETETYPE>(string instanceName) + { + _alterations.Add( + delegate(PluginFamily family) + { + Plugin plugin = Plugin.CreateImplicitPlugin(typeof (CONCRETETYPE)); + plugin.ConcreteKey = instanceName; + family.Plugins.Add(plugin); + } + ); + + return this; + } + + public CreatePluginFamilyExpression<PLUGINTYPE> InterceptConstructionWith(InstanceFactoryInterceptor interceptor) + { + _alterations.Add(delegate(PluginFamily family){family.InterceptionChain.AddInterceptor(interceptor);}); + return this; + } } } \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,67 +0,0 @@ -using System; - -namespace StructureMap.Configuration.DSL.Expressions -{ - public class LiteralMemento : InstanceMemento - { - private object _instance; - - public LiteralMemento(object instance) - { - _instance = instance; - InstanceKey = Guid.NewGuid().ToString(); - } - - public LiteralMemento Named(string name) - { - InstanceKey = name; - return this; - } - - public object Instance - { - get { return _instance; } - set { _instance = value; } - } - - protected override string innerConcreteKey - { - get { throw new NotImplementedException(); } - } - - protected override string innerInstanceKey - { - get { throw new NotImplementedException(); } - } - - protected override string getPropertyValue(string Key) - { - throw new NotImplementedException(); - } - - protected override InstanceMemento getChild(string Key) - { - throw new NotImplementedException(); - } - - public override InstanceMemento[] GetChildrenArray(string Key) - { - throw new NotImplementedException(); - } - - public override bool IsReference - { - get { return false; } - } - - public override string ReferenceKey - { - get { throw new NotImplementedException(); } - } - - protected override object buildInstance(IInstanceCreator creator) - { - return _instance; - } - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -10,7 +10,7 @@ public class ProfileExpression : IExpression { private readonly string _profileName; - private List<InstanceDefaultExpression> _defaults = new List<InstanceDefaultExpression>(); + private readonly List<InstanceDefaultExpression> _defaults = new List<InstanceDefaultExpression>(); public ProfileExpression(string profileName) { Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -12,8 +12,14 @@ /// </summary> public class ScanAssembliesExpression : IExpression { - private List<AssemblyGraph> _assemblies = new List<AssemblyGraph>(); + private readonly Registry _registry; + private readonly List<AssemblyGraph> _assemblies = new List<AssemblyGraph>(); + public ScanAssembliesExpression(Registry registry) + { + _registry = registry; + } + void IExpression.Configure(PluginGraph graph) { foreach (AssemblyGraph assembly in _assemblies) @@ -59,5 +65,23 @@ return this; } + + public ScanAssembliesExpression AddAllTypesOf<PLUGINTYPE>() + { + _registry.addExpression(delegate (PluginGraph pluginGraph) + { + PluginFamily family = + pluginGraph.LocateOrCreateFamilyForType(typeof (PLUGINTYPE)); + family.CanUseUnMarkedPlugins = true; + }); + + return this; + } + + public ScanAssembliesExpression IncludeAssembly(string assemblyName) + { + _assemblies.Add(new AssemblyGraph(assemblyName)); + return this; + } } } \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/IMementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/IMementoBuilder.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/IMementoBuilder.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,14 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - public interface IMementoBuilder : IExpression - { - InstanceMemento BuildMemento(PluginFamily family); - InstanceMemento BuildMemento(PluginGraph graph); - void SetInstanceName(string instanceKey); - - void ValidatePluggability(Type pluginType); - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/InstanceDefaultExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/InstanceDefaultExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/InstanceDefaultExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,69 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Use to express the instance of a PluginType for the containing Profile - /// </summary> - public class InstanceDefaultExpression - { - private readonly Type _pluginType; - private readonly ProfileExpression _parent; - private string _instanceKey = string.Empty; - private IMementoBuilder _mementoBuilder; - - public InstanceDefaultExpression(Type pluginType, ProfileExpression parent) - { - _pluginType = pluginType; - _parent = parent; - } - - /// <summary> - /// Use a named, preconfigured instance as the default instance for this profile - /// </summary> - /// <param name="instanceKey"></param> - /// <returns></returns> - public ProfileExpression UseNamedInstance(string instanceKey) - { - _instanceKey = instanceKey; - return _parent; - } - - internal void Configure(Profile profile, PluginGraph graph) - { - if (!string.IsNullOrEmpty(_instanceKey)) - { - InstanceDefault instanceDefault = new InstanceDefault(_pluginType, _instanceKey); - profile.AddOverride(instanceDefault); - } - else if (_mementoBuilder != null) - { - string defaultKey = Profile.InstanceKeyForProfile(profile.ProfileName); - InstanceMemento memento = _mementoBuilder.BuildMemento(graph); - memento.InstanceKey = defaultKey; - - graph.PluginFamilies[_pluginType].AddInstance(memento); - - InstanceDefault instanceDefault = new InstanceDefault(_pluginType, defaultKey); - profile.AddOverride(instanceDefault); - } - else - { - throw new StructureMapException(304, TypePath.GetAssemblyQualifiedName(_pluginType)); - } - } - - /// <summary> - /// Define the default instance of the PluginType for the containing Profile - /// </summary> - /// <param name="mementoBuilder"></param> - /// <returns></returns> - public ProfileExpression Use(IMementoBuilder mementoBuilder) - { - _mementoBuilder = mementoBuilder; - - return _parent; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,192 +0,0 @@ -using System; -using StructureMap.Configuration.DSL.Expressions; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Used to define an Instance in code - /// </summary> - public class InstanceExpression : MementoBuilder<InstanceExpression> - { - private Type _pluggedType; - private MemoryInstanceMemento _memento; - - public InstanceExpression(Type pluginType) : base(pluginType) - { - } - - - internal Type PluggedType - { - get { return _pluggedType; } - } - - protected override void buildMemento() - { - _memento = new MemoryInstanceMemento(); - } - - - protected override InstanceMemento memento - { - get { return _memento; } - } - - protected override InstanceExpression thisInstance - { - get { return this; } - } - - protected override void configureMemento(PluginFamily family) - { - Plugin plugin = _pluggedType == null - ? family.Plugins[_memento.ConcreteKey] - : family.Plugins.FindOrCreate(_pluggedType); - - _memento.ConcreteKey = plugin.ConcreteKey; - } - - protected override void validate() - { - if (_pluggedType == null && string.IsNullOrEmpty(_memento.ConcreteKey)) - { - throw new StructureMapException(301, _memento.InstanceKey, - TypePath.GetAssemblyQualifiedName(_pluginType)); - } - } - - - /// <summary> - /// Start the definition of a primitive argument to a constructor argument - /// </summary> - /// <param name="propertyName"></param> - /// <returns></returns> - public PropertyExpression WithProperty(string propertyName) - { - return new PropertyExpression(this, _memento, propertyName); - } - - /// <summary> - /// Starts the definition of a child instance specifying the argument name - /// in the case of a constructor function that consumes more than one argument - /// of type T - /// </summary> - /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam> - /// <param name="propertyName"></param> - /// <returns></returns> - public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>(string propertyName) - { - ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName); - addChildExpression(child); - child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE); - - return child; - } - - /// <summary> - /// Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE - /// </summary> - /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam> - /// <returns></returns> - public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>() - { - string propertyName = findPropertyName<CONSTRUCTORARGUMENTTYPE>(); - - ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName); - addChildExpression(child); - child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE); - return child; - } - - private string findPropertyName<T>() - { - Plugin plugin = Plugin.CreateImplicitPlugin(_pluggedType); - string propertyName = plugin.FindFirstConstructorArgumentOfType<T>(); - - if (string.IsNullOrEmpty(propertyName)) - { - throw new StructureMapException(305, TypePath.GetAssemblyQualifiedName(typeof (T))); - } - - return propertyName; - } - - public override void ValidatePluggability(Type pluginType) - { - if (_pluggedType == null) - { - return; - } - - ExpressionValidator.ValidatePluggabilityOf(_pluggedType).IntoPluginType(pluginType); - } - - internal InstanceTypeExpression TypeExpression() - { - return new InstanceTypeExpression(this); - } - - /// <summary> - /// Helper class to capture the actual concrete type of an Instance - /// </summary> - public class InstanceTypeExpression - { - private readonly InstanceExpression _parent; - - internal InstanceTypeExpression(InstanceExpression parent) - { - _parent = parent; - } - - /// <summary> - /// Use type T for the concrete type of an instance - /// </summary> - /// <typeparam name="T"></typeparam> - /// <returns></returns> - public InstanceExpression UsingConcreteType<T>() - { - _parent._pluggedType = typeof (T); - return _parent; - } - - /// <summary> - /// Use a named Plugin type denoted by a [Pluggable("Key")] attribute - /// </summary> - /// <param name="concreteKey"></param> - /// <returns></returns> - public InstanceExpression UsingConcreteTypeNamed(string concreteKey) - { - _parent._memento.ConcreteKey = concreteKey; - return _parent; - } - } - - public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>() - { - validateTypeIsArray<PLUGINTYPE>(); - - string propertyName = findPropertyName<PLUGINTYPE>(); - return ChildArray<PLUGINTYPE>(propertyName); - } - - public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>(string propertyName) - { - validateTypeIsArray<PLUGINTYPE>(); - - ChildArrayExpression<PLUGINTYPE> expression = - new ChildArrayExpression<PLUGINTYPE>(this, _memento, propertyName); - addChildExpression(expression); - - return expression; - } - - private static void validateTypeIsArray<PLUGINTYPE>() - { - if (!typeof (PLUGINTYPE).IsArray) - { - throw new StructureMapException(307); - } - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/LiteralExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/LiteralExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/LiteralExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,50 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Small helper class to represent an object to be plugged into a PluginType as is - /// </summary> - /// <typeparam name="T"></typeparam> - public class LiteralExpression<T> : MementoBuilder<LiteralExpression<T>> - { - private readonly T _target; - private LiteralMemento _memento; - - public LiteralExpression(T target) : base(typeof (T)) - { - _target = target; - } - - - protected override InstanceMemento memento - { - get { return _memento; } - } - - protected override LiteralExpression<T> thisInstance - { - get { return this; } - } - - protected override void configureMemento(PluginFamily family) - { - _memento.Instance = _target; - } - - protected override void validate() - { - } - - protected override void buildMemento() - { - _memento = new LiteralMemento(null); - } - - public override void ValidatePluggability(Type pluginType) - { - ExpressionValidator.ValidatePluggabilityOf(_target.GetType()).IntoPluginType(pluginType); - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,67 +0,0 @@ -using System; - -namespace StructureMap.Configuration.DSL -{ - public class LiteralMemento : InstanceMemento - { - private object _instance; - - public LiteralMemento(object instance) - { - _instance = instance; - InstanceKey = Guid.NewGuid().ToString(); - } - - public LiteralMemento Named(string name) - { - InstanceKey = name; - return this; - } - - public object Instance - { - get { return _instance; } - set { _instance = value; } - } - - protected override string innerConcreteKey - { - get { throw new NotImplementedException(); } - } - - protected override string innerInstanceKey - { - get { throw new NotImplementedException(); } - } - - protected override string getPropertyValue(string Key) - { - throw new NotImplementedException(); - } - - protected override InstanceMemento getChild(string Key) - { - throw new NotImplementedException(); - } - - public override InstanceMemento[] GetChildrenArray(string Key) - { - throw new NotImplementedException(); - } - - public override bool IsReference - { - get { return false; } - } - - public override string ReferenceKey - { - get { throw new NotImplementedException(); } - } - - protected override object buildInstance(IInstanceCreator creator) - { - return _instance; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,116 +0,0 @@ -using System; -using System.Collections.Generic; -using StructureMap.Configuration.DSL.Expressions; -using StructureMap.Graph; -using StructureMap.Interceptors; - -namespace StructureMap.Configuration.DSL -{ - // TODO -- T must be constrained to be MementoBuilder - public abstract class MementoBuilder<T> : IExpression, IMementoBuilder - { - protected readonly Type _pluginType; - protected List<IExpression> _children = new List<IExpression>(); - private string _instanceKey = null; - - public MementoBuilder(Type pluginType) - { - _pluginType = pluginType; - buildMemento(); - memento.InstanceKey = Guid.NewGuid().ToString(); - } - - void IExpression.Configure(PluginGraph graph) - { - validate(); - PluginFamily family = graph.LocateOrCreateFamilyForType((Type) _pluginType); - configureMemento(family); - - if (!string.IsNullOrEmpty(_instanceKey)) - { - memento.InstanceKey = _instanceKey; - } - - family.Source.AddExternalMemento(memento); - - foreach (IExpression child in _children) - { - child.Configure(graph); - } - } - - protected abstract InstanceMemento memento { get; } - - protected abstract T thisInstance { get; } - - protected abstract void configureMemento(PluginFamily family); - - protected abstract void validate(); - - public T WithName(string instanceKey) - { - memento.InstanceKey = instanceKey; - return thisInstance; - } - - public T OnCreation<TYPE>(StartupHandler<TYPE> handler) - { - StartupInterceptor<TYPE> interceptor = new StartupInterceptor<TYPE>(handler); - memento.Interceptor = interceptor; - - return thisInstance; - } - - public T EnrichWith<TYPE>(EnrichmentHandler<TYPE> handler) - { - EnrichmentInterceptor<TYPE> interceptor = new EnrichmentInterceptor<TYPE>(handler); - memento.Interceptor = interceptor; - - return thisInstance; - } - - public string InstanceKey - { - get { return memento.InstanceKey; } - set { memento.InstanceKey = value; } - } - - internal Type PluginType - { - get { return _pluginType; } - } - - protected abstract void buildMemento(); - - InstanceMemento IMementoBuilder.BuildMemento(PluginFamily family) - { - return buildMementoFromFamily(family); - } - - private InstanceMemento buildMementoFromFamily(PluginFamily family) - { - validate(); - configureMemento(family); - return memento; - } - - - InstanceMemento IMementoBuilder.BuildMemento(PluginGraph graph) - { - PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); - return buildMementoFromFamily(family); - } - - public void SetInstanceName(string instanceKey) - { - _instanceKey = instanceKey; - } - - public abstract void ValidatePluggability(Type pluginType); - - protected void addChildExpression(IExpression expression) - { - _children.Add(expression); - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using StructureMap.Configuration.DSL.Expressions; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Expression class to help define a runtime Profile - /// </summary> - public class ProfileExpression : IExpression - { - private readonly string _profileName; - private List<InstanceDefaultExpression> _defaults = new List<InstanceDefaultExpression>(); - - public ProfileExpression(string profileName) - { - _profileName = profileName; - } - - void IExpression.Configure(PluginGraph graph) - { - Profile profile = graph.DefaultManager.GetProfile(_profileName); - if (profile == null) - { - profile = new Profile(_profileName); - graph.DefaultManager.AddProfile(profile); - } - - foreach (InstanceDefaultExpression expression in _defaults) - { - expression.Configure(profile, graph); - } - } - - /// <summary> - /// Starts the definition of the default instance for the containing Profile - /// </summary> - /// <typeparam name="T"></typeparam> - /// <returns></returns> - public InstanceDefaultExpression For<T>() - { - InstanceDefaultExpression defaultExpression = new InstanceDefaultExpression(typeof (T), this); - _defaults.Add(defaultExpression); - - return defaultExpression; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,45 +0,0 @@ -using System.Configuration; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Defines the value of a primitive argument to a constructur argument - /// </summary> - public class PropertyExpression - { - private readonly InstanceExpression _instance; - private readonly MemoryInstanceMemento _memento; - private readonly string _propertyName; - - public PropertyExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName) - { - _instance = instance; - _memento = memento; - _propertyName = propertyName; - } - - /// <summary> - /// Sets the value of the constructor argument - /// </summary> - /// <param name="propertyValue"></param> - /// <returns></returns> - public InstanceExpression EqualTo(object propertyValue) - { - _memento.SetProperty(_propertyName, propertyValue.ToString()); - return _instance; - } - - /// <summary> - /// Sets the value of the constructor argument to the key/value in the - /// AppSettings - /// </summary> - /// <param name="appSettingKey"></param> - /// <returns></returns> - public InstanceExpression EqualToAppSetting(string appSettingKey) - { - string propertyValue = ConfigurationManager.AppSettings[appSettingKey]; - _memento.SetProperty(_propertyName, propertyValue); - return _instance; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,50 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Sets up a Prototype instance of type T - /// </summary> - /// <typeparam name="T"></typeparam> - public class PrototypeExpression<T> : MementoBuilder<PrototypeExpression<T>> - { - private readonly T _prototype; - private PrototypeMemento _memento; - - public PrototypeExpression(T prototype) : base(typeof (T)) - { - _prototype = prototype; - } - - protected override InstanceMemento memento - { - get { return _memento; } - } - - protected override PrototypeExpression<T> thisInstance - { - get { return this; } - } - - protected override void configureMemento(PluginFamily family) - { - _memento.Prototype = (ICloneable) _prototype; - } - - protected override void validate() - { - // TODO - } - - protected override void buildMemento() - { - _memento = new PrototypeMemento(string.Empty, (ICloneable) _prototype); - } - - public override void ValidatePluggability(Type pluginType) - { - ExpressionValidator.ValidatePluggabilityOf(_prototype.GetType()).IntoPluginType(pluginType); - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,63 +0,0 @@ -using System; - -namespace StructureMap.Configuration.DSL -{ - public class PrototypeMemento : InstanceMemento - { - private readonly string _instanceKey; - private ICloneable _prototype; - - public PrototypeMemento(string instanceKey, ICloneable prototype) - { - _instanceKey = instanceKey; - _prototype = prototype; - } - - - public ICloneable Prototype - { - get { return _prototype; } - set { _prototype = value; } - } - - protected override object buildInstance(IInstanceCreator creator) - { - return _prototype.Clone(); - } - - protected override string innerConcreteKey - { - get { return string.Empty; } - } - - protected override string innerInstanceKey - { - get { return _instanceKey; } - } - - protected override string getPropertyValue(string Key) - { - throw new NotImplementedException(); - } - - protected override InstanceMemento getChild(string Key) - { - throw new NotImplementedException(); - } - - public override InstanceMemento[] GetChildrenArray(string Key) - { - throw new NotImplementedException(); - } - - public override bool IsReference - { - get { return false; } - } - - public override string ReferenceKey - { - get { throw new NotImplementedException(); } - } - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -8,8 +8,8 @@ { public class Registry : IDisposable { - private List<IExpression> _expressions = new List<IExpression>(); - private PluginGraph _graph; + private readonly List<IExpression> _expressions = new List<IExpression>(); + private readonly PluginGraph _graph; public Registry(PluginGraph graph) : this() { @@ -22,7 +22,15 @@ configure(); } + #region IDisposable Members + public void Dispose() + { + ConfigurePluginGraph(_graph); + } + + #endregion + /// <summary> /// Implement this method to /// </summary> @@ -50,11 +58,6 @@ } - public void Dispose() - { - ConfigurePluginGraph(_graph); - } - /// <summary> /// Direct StructureMap to build instances of type T, and look for concrete classes /// marked with the [Pluggable] attribute that implement type T @@ -232,43 +235,54 @@ public void RegisterInterceptor(TypeInterceptor interceptor) { - addExpression(delegate (PluginGraph pluginGraph) - { - pluginGraph.InterceptorLibrary.AddInterceptor(interceptor); - }); + addExpression( + delegate(PluginGraph pluginGraph) { pluginGraph.InterceptorLibrary.AddInterceptor(interceptor); }); } - public TypeInterceptorExpression IfTypeMatches(TypeMatchDelegate match) + public TypeInterceptorExpression IfTypeMatches(Predicate<Type> match) { TypeInterceptorExpression expression = new TypeInterceptorExpression(match); _expressions.Add(expression); return expression; } + + + /// <summary> + /// Programmatically determine Assembly's to be scanned for attribute configuration + /// </summary> + /// <returns></returns> + public ScanAssembliesExpression ScanAssemblies() + { + ScanAssembliesExpression expression = new ScanAssembliesExpression(this); + addExpression(expression); + + return expression; + } } - public delegate object InterceptionDelegate(object instance); - public delegate bool TypeMatchDelegate(Type type); + public class TypeInterceptorExpression : IExpression, TypeInterceptor { - private readonly TypeMatchDelegate _match; + private readonly Predicate<Type> _match; private InterceptionDelegate _interception; - internal TypeInterceptorExpression(TypeMatchDelegate match) + internal TypeInterceptorExpression(Predicate<Type> match) { _match = match; } + #region IExpression Members + void IExpression.Configure(PluginGraph graph) { graph.InterceptorLibrary.AddInterceptor(this); } - public void InterceptWith(InterceptionDelegate interception) - { - _interception = interception; - } + #endregion + #region TypeInterceptor Members + public bool MatchesType(Type type) { return _match(type); @@ -278,9 +292,17 @@ { return _interception(target); } + + #endregion + + public void InterceptWith(InterceptionDelegate interception) + { + _interception = interception; + } } internal delegate void PluginGraphAlteration(PluginGraph pluginGraph); + internal class BasicExpression : IExpression { private readonly PluginGraphAlteration _alteration; @@ -290,9 +312,13 @@ _alteration = alteration; } + #region IExpression Members + public void Configure(PluginGraph graph) { _alteration(graph); } + + #endregion } } \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,63 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Threading; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - /// <summary> - /// Expression that directs StructureMap to scan the named assemblies - /// for [PluginFamily] and [Plugin] attributes - /// </summary> - public class ScanAssembliesExpression : IExpression - { - private List<AssemblyGraph> _assemblies = new List<AssemblyGraph>(); - - void IExpression.Configure(PluginGraph graph) - { - foreach (AssemblyGraph assembly in _assemblies) - { - graph.Assemblies.Add(assembly); - } - } - - public ScanAssembliesExpression IncludeTheCallingAssembly() - { - Assembly callingAssembly = findTheCallingAssembly(); - - if (callingAssembly != null) - { - _assemblies.Add(new AssemblyGraph(callingAssembly)); - } - - return this; - } - - private static Assembly findTheCallingAssembly() - { - StackTrace trace = new StackTrace(Thread.CurrentThread, false); - - Assembly thisAssembly = Assembly.GetExecutingAssembly(); - Assembly callingAssembly = null; - for (int i = 0; i < trace.FrameCount; i++) - { - StackFrame frame = trace.GetFrame(i); - Assembly assembly = frame.GetMethod().DeclaringType.Assembly; - if (assembly != thisAssembly) - { - callingAssembly = assembly; - break; - } - } - return callingAssembly; - } - - public ScanAssembliesExpression IncludeAssemblyContainingType<T>() - { - _assemblies.Add(AssemblyGraph.ContainingType<T>()); - - return this; - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,45 +0,0 @@ -using System; -using StructureMap.Graph; - -namespace StructureMap.Configuration.DSL -{ - public class UserControlExpression : MementoBuilder<UserControlExpression> - { - private UserControlMemento _memento; - - public UserControlExpression(Type pluginType, string url) : base(pluginType) - { - _memento.Url = url; - } - - protected override InstanceMemento memento - { - get { return _memento; } - } - - protected override UserControlExpression thisInstance - { - get { return this; } - } - - protected override void configureMemento(PluginFamily family) - { - // no-op - } - - protected override void validate() - { - // no-op - } - - protected override void buildMemento() - { - _memento = new UserControlMemento(); - } - - public override void ValidatePluggability(Type pluginType) - { - // no-op - } - } -} \ No newline at end of file Deleted: trunk/Source/StructureMap/Configuration/UserControlMemento.cs =================================================================== --- trunk/Source/StructureMap/Configuration/UserControlMemento.cs 2008-01-14 04:24:37 UTC (rev 55) +++ trunk/Source/StructureMap/Configuration/UserControlMemento.cs 2008-01-15 15:15:50 UTC (rev 56) @@ -1,68 +0,0 @@ -using System; -using System.Web.UI; - -namespace StructureMap.Configuration -{ - public class UserControlMemento : InstanceMemento - { - private string _instanceKey; - private string _url; - - public UserControlMemento(string instanceKey, string url) - { - _instanceKey = instanceKey; - _url = url; - } - - - public UserControlMemento() - { - } - - public string Url - { - get { return _url; } - set { _url = value; } - } - - protected override object buildInstance(IInstanceCreator creator) - { - return new Page().LoadControl(_url); - } - - protected override string innerConcreteKey - { - get { return string.Empty; } - } - - protected override string innerInstanceKey - { - get { return _instanceKey; } - } - - protected override string getPropertyValue(string Key) - { - throw new NotImplementedException(); - } - - protected override InstanceMemento getChild(string Key) - { - throw new NotImplementedException(); - } - - public override InstanceMemento[] GetChildrenArray(string Key) - { - throw new NotImplementedException(); - } - - public override bool IsReference - { - get { return false; } - } - - public override string ReferenceKey - { - get { throw new NotImplementedException(); } - } - } -} \ No newline at end of file Added: trunk/Source/StructureMap/Delegates.c... [truncated message content] |
From: <jer...@us...> - 2008-01-14 04:24:38
|
Revision: 55 http://structuremap.svn.sourceforge.net/structuremap/?rev=55&view=rev Author: jeremydmiller Date: 2008-01-13 20:24:37 -0800 (Sun, 13 Jan 2008) Log Message: ----------- consolidating namespaces Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs trunk/Source/StructureMap/ConstructorMemento.cs trunk/Source/StructureMap/Graph/Plugin.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap.Testing/Client/Controllers/TreeBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DiagnosticGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/FamilyTokenTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/InstanceTokenTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/MockInterceptor.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/MockMementoSource.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildArrayPropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildPropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/EnumerationPropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/PrimitivePropertyTester.cs trunk/Source/StructureMap.Testing/Configuration/Tokens/PropertyDefinitionTester.cs trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs trunk/Source/StructureMap.Testing/Container/Source/XmlTemplaterTester.cs trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs trunk/Source/StructureMap.Testing/ImplicitPluginFromPluggedTypeAttributeTester.cs trunk/Source/StructureMap.Testing.Widget/Rule.cs Added Paths: ----------- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs trunk/Source/StructureMap/Configuration/Mementos/ trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs Removed Paths: ------------- trunk/Source/StructureMap/MemoryInstanceMemento.cs Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.Configuration.DSL.Expressions Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.Configuration.DSL.Expressions Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs (from rev 54, trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -0,0 +1,193 @@ +using System; +using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Used to define an Instance in code + /// </summary> + public class InstanceExpression : MementoBuilder<InstanceExpression> + { + private Type _pluggedType; + private MemoryInstanceMemento _memento; + + public InstanceExpression(Type pluginType) : base(pluginType) + { + } + + + internal Type PluggedType + { + get { return _pluggedType; } + } + + protected override void buildMemento() + { + _memento = new MemoryInstanceMemento(); + } + + + protected override InstanceMemento memento + { + get { return _memento; } + } + + protected override InstanceExpression thisInstance + { + get { return this; } + } + + protected override void configureMemento(PluginFamily family) + { + Plugin plugin = _pluggedType == null + ? family.Plugins[_memento.ConcreteKey] + : family.Plugins.FindOrCreate(_pluggedType); + + _memento.ConcreteKey = plugin.ConcreteKey; + } + + protected override void validate() + { + if (_pluggedType == null && string.IsNullOrEmpty(_memento.ConcreteKey)) + { + throw new StructureMapException(301, _memento.InstanceKey, + TypePath.GetAssemblyQualifiedName(_pluginType)); + } + } + + + /// <summary> + /// Start the definition of a primitive argument to a constructor argument + /// </summary> + /// <param name="propertyName"></param> + /// <returns></returns> + public PropertyExpression WithProperty(string propertyName) + { + return new PropertyExpression(this, _memento, propertyName); + } + + /// <summary> + /// Starts the definition of a child instance specifying the argument name + /// in the case of a constructor function that consumes more than one argument + /// of type T + /// </summary> + /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam> + /// <param name="propertyName"></param> + /// <returns></returns> + public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>(string propertyName) + { + ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName); + addChildExpression(child); + child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE); + + return child; + } + + /// <summary> + /// Start the definition of a child instance for type CONSTRUCTORARGUMENTTYPE + /// </summary> + /// <typeparam name="CONSTRUCTORARGUMENTTYPE"></typeparam> + /// <returns></returns> + public ChildInstanceExpression Child<CONSTRUCTORARGUMENTTYPE>() + { + string propertyName = findPropertyName<CONSTRUCTORARGUMENTTYPE>(); + + ChildInstanceExpression child = new ChildInstanceExpression(this, _memento, propertyName); + addChildExpression(child); + child.ChildType = typeof (CONSTRUCTORARGUMENTTYPE); + return child; + } + + private string findPropertyName<T>() + { + Plugin plugin = Plugin.CreateImplicitPlugin(_pluggedType); + string propertyName = plugin.FindFirstConstructorArgumentOfType<T>(); + + if (string.IsNullOrEmpty(propertyName)) + { + throw new StructureMapException(305, TypePath.GetAssemblyQualifiedName(typeof (T))); + } + + return propertyName; + } + + public override void ValidatePluggability(Type pluginType) + { + if (_pluggedType == null) + { + return; + } + + ExpressionValidator.ValidatePluggabilityOf(_pluggedType).IntoPluginType(pluginType); + } + + internal InstanceTypeExpression TypeExpression() + { + return new InstanceTypeExpression(this); + } + + /// <summary> + /// Helper class to capture the actual concrete type of an Instance + /// </summary> + public class InstanceTypeExpression + { + private readonly InstanceExpression _parent; + + internal InstanceTypeExpression(InstanceExpression parent) + { + _parent = parent; + } + + /// <summary> + /// Use type T for the concrete type of an instance + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public InstanceExpression UsingConcreteType<T>() + { + _parent._pluggedType = typeof (T); + return _parent; + } + + /// <summary> + /// Use a named Plugin type denoted by a [Pluggable("Key")] attribute + /// </summary> + /// <param name="concreteKey"></param> + /// <returns></returns> + public InstanceExpression UsingConcreteTypeNamed(string concreteKey) + { + _parent._memento.ConcreteKey = concreteKey; + return _parent; + } + } + + public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>() + { + validateTypeIsArray<PLUGINTYPE>(); + + string propertyName = findPropertyName<PLUGINTYPE>(); + return ChildArray<PLUGINTYPE>(propertyName); + } + + public ChildArrayExpression<PLUGINTYPE> ChildArray<PLUGINTYPE>(string propertyName) + { + validateTypeIsArray<PLUGINTYPE>(); + + ChildArrayExpression<PLUGINTYPE> expression = + new ChildArrayExpression<PLUGINTYPE>(this, _memento, propertyName); + addChildExpression(expression); + + return expression; + } + + private static void validateTypeIsArray<PLUGINTYPE>() + { + if (!typeof (PLUGINTYPE).IsArray) + { + throw new StructureMapException(307); + } + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.Configuration.DSL.Expressions Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs (from rev 54, trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/MementoBuilder.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Graph; +using StructureMap.Interceptors; + +namespace StructureMap.Configuration.DSL.Expressions +{ + public abstract class MementoBuilder<T> : IExpression, IMementoBuilder + { + protected readonly Type _pluginType; + protected List<IExpression> _children = new List<IExpression>(); + private string _instanceKey = null; + + public MementoBuilder(Type pluginType) + { + _pluginType = pluginType; + buildMemento(); + memento.InstanceKey = Guid.NewGuid().ToString(); + } + + void IExpression.Configure(PluginGraph graph) + { + validate(); + PluginFamily family = graph.LocateOrCreateFamilyForType((Type) _pluginType); + configureMemento(family); + + if (!string.IsNullOrEmpty(_instanceKey)) + { + memento.InstanceKey = _instanceKey; + } + + family.Source.AddExternalMemento(memento); + + foreach (IExpression child in _children) + { + child.Configure(graph); + } + } + + protected abstract InstanceMemento memento { get; } + + protected abstract T thisInstance { get; } + + protected abstract void configureMemento(PluginFamily family); + + protected abstract void validate(); + + public T WithName(string instanceKey) + { + memento.InstanceKey = instanceKey; + return thisInstance; + } + + public T OnCreation<TYPE>(StartupHandler<TYPE> handler) + { + StartupInterceptor<TYPE> interceptor = new StartupInterceptor<TYPE>(handler); + memento.Interceptor = interceptor; + + return thisInstance; + } + + public T EnrichWith<TYPE>(EnrichmentHandler<TYPE> handler) + { + EnrichmentInterceptor<TYPE> interceptor = new EnrichmentInterceptor<TYPE>(handler); + memento.Interceptor = interceptor; + + return thisInstance; + } + + public string InstanceKey + { + get { return memento.InstanceKey; } + set { memento.InstanceKey = value; } + } + + internal Type PluginType + { + get { return _pluginType; } + } + + protected abstract void buildMemento(); + + InstanceMemento IMementoBuilder.BuildMemento(PluginFamily family) + { + return buildMementoFromFamily(family); + } + + private InstanceMemento buildMementoFromFamily(PluginFamily family) + { + validate(); + configureMemento(family); + return memento; + } + + + InstanceMemento IMementoBuilder.BuildMemento(PluginGraph graph) + { + PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); + return buildMementoFromFamily(family); + } + + public void SetInstanceName(string instanceKey) + { + _instanceKey = instanceKey; + } + + public abstract void ValidatePluggability(Type pluginType); + + protected void addChildExpression(IExpression expression) + { + _children.Add(expression); + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs (from rev 54, trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ProfileExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Expression class to help define a runtime Profile + /// </summary> + public class ProfileExpression : IExpression + { + private readonly string _profileName; + private List<InstanceDefaultExpression> _defaults = new List<InstanceDefaultExpression>(); + + public ProfileExpression(string profileName) + { + _profileName = profileName; + } + + void IExpression.Configure(PluginGraph graph) + { + Profile profile = graph.DefaultManager.GetProfile(_profileName); + if (profile == null) + { + profile = new Profile(_profileName); + graph.DefaultManager.AddProfile(profile); + } + + foreach (InstanceDefaultExpression expression in _defaults) + { + expression.Configure(profile, graph); + } + } + + /// <summary> + /// Starts the definition of the default instance for the containing Profile + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public InstanceDefaultExpression For<T>() + { + InstanceDefaultExpression defaultExpression = new InstanceDefaultExpression(typeof (T), this); + _defaults.Add(defaultExpression); + + return defaultExpression; + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System.Configuration; +using StructureMap.Configuration.Mementos; namespace StructureMap.Configuration.DSL.Expressions { Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.Configuration.DSL.Expressions Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.Configuration.DSL.Expressions Modified: trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,5 +1,6 @@ using System; using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.Configuration.DSL Copied: trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs (from rev 54, trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/Mementos/LiteralMemento.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -0,0 +1,67 @@ +using System; + +namespace StructureMap.Configuration.Mementos +{ + public class LiteralMemento : InstanceMemento + { + private object _instance; + + public LiteralMemento(object instance) + { + _instance = instance; + InstanceKey = Guid.NewGuid().ToString(); + } + + public LiteralMemento Named(string name) + { + InstanceKey = name; + return this; + } + + public object Instance + { + get { return _instance; } + set { _instance = value; } + } + + protected override string innerConcreteKey + { + get { throw new NotImplementedException(); } + } + + protected override string innerInstanceKey + { + get { throw new NotImplementedException(); } + } + + protected override string getPropertyValue(string Key) + { + throw new NotImplementedException(); + } + + protected override InstanceMemento getChild(string Key) + { + throw new NotImplementedException(); + } + + public override InstanceMemento[] GetChildrenArray(string Key) + { + throw new NotImplementedException(); + } + + public override bool IsReference + { + get { return false; } + } + + public override string ReferenceKey + { + get { throw new NotImplementedException(); } + } + + protected override object buildInstance(IInstanceCreator creator) + { + return _instance; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs (from rev 53, trunk/Source/StructureMap/MemoryInstanceMemento.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/Mementos/MemoryInstanceMemento.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -0,0 +1,209 @@ +using System.Collections; +using System.Collections.Specialized; +using StructureMap.Graph; + +namespace StructureMap.Configuration.Mementos +{ + public class GenericMemento<T> : MemoryInstanceMemento + { + public GenericMemento(string instanceKey) + : base(Plugin.CreateImplicitPlugin(typeof (T)).ConcreteKey, instanceKey) + { + } + } + + /// <summary> + /// An in-memory implementation of InstanceMemento. + /// </summary> + public class MemoryInstanceMemento : InstanceMemento + { + #region statics + + /// <summary> + /// Creates an instance of MemoryInstanceMemento that represents a reference to another + /// instance. + /// </summary> + /// <param name="referenceKey">The referenced instance key to another instance</param> + /// <returns></returns> + public static MemoryInstanceMemento CreateReferencedInstanceMemento(string referenceKey) + { + MemoryInstanceMemento memento = new MemoryInstanceMemento(); + memento._referenceKey = referenceKey; + memento._isReference = true; + + return memento; + } + + /// <summary> + /// Creates a MemoryInstanceMemento that represents a reference to the default instance + /// of a plugin type. + /// </summary> + /// <returns></returns> + public static MemoryInstanceMemento CreateDefaultInstanceMemento() + { + MemoryInstanceMemento memento = new MemoryInstanceMemento(); + memento._referenceKey = string.Empty; + memento._isReference = true; + + return memento; + } + + #endregion + + private NameValueCollection _properties = new NameValueCollection(); + private Hashtable _children = new Hashtable(); + private string _concreteKey; + private string _instanceKey; + private bool _isReference; + private string _referenceKey; + + + /// <summary> + /// Constructs a MemoryInstanceMemento without properties + /// </summary> + /// <param name="concreteKey">The concrete key of the plugin type</param> + /// <param name="instanceKey">The identifying instance key</param> + public MemoryInstanceMemento(string concreteKey, string instanceKey) + : this(concreteKey, instanceKey, new NameValueCollection()) + { + } + + + /// <summary> + /// Constructs a MemoryInstanceMemento with properties + /// </summary> + /// <param name="concreteKey">The concrete key of the plugin type</param> + /// <param name="instanceKey">The identifying instance key</param> + /// <param name="properties">NameValueCollection of instance properties</param> + public MemoryInstanceMemento(string concreteKey, string instanceKey, NameValueCollection properties) + { + _properties = properties; + _concreteKey = concreteKey; + _instanceKey = instanceKey; + } + + + public MemoryInstanceMemento() + { + } + + /// <summary> + /// Sets the value of the named property + /// </summary> + /// <param name="name"></param> + /// <param name="value"></param> + public void SetProperty(string name, string value) + { + string stringValue = value == string.Empty ? EMPTY_STRING : value; + _properties[name] = stringValue; + } + + public void SetTemplateKey(string templateName) + { + SetProperty(TEMPLATE_ATTRIBUTE, templateName); + } + + /// <summary> + /// Deletes a named property from the DefaultInstanceMemento + /// </summary> + /// <param name="Name"></param> + public void RemoveProperty(string Name) + { + _properties.Remove(Name); + } + + /// <summary> + /// Links a child InstanceMemento as a named property + /// </summary> + /// <param name="name"></param> + /// <param name="Memento"></param> + public void AddChild(string name, InstanceMemento Memento) + { + _children.Add(name, Memento); + } + + public void ReferenceChild(string name, string instanceKey) + { + InstanceMemento child = CreateReferencedInstanceMemento(instanceKey); + AddChild(name, child); + } + + + /// <summary> + /// Links an array of InstanceMemento's to a named array property + /// </summary> + /// <param name="name"></param> + /// <param name="childMementos"></param> + public void AddChildArray(string name, InstanceMemento[] childMementos) + { + _children.Add(name, childMementos); + } + + #region InstanceMemento Members + + /// <summary> + /// See <cref>InstanceMemento</cref> + /// </summary> + protected override string innerConcreteKey + { + get { return _concreteKey; } + } + + /// <summary> + /// See <cref>InstanceMemento</cref> + /// </summary> + protected override string innerInstanceKey + { + get { return _instanceKey; } + } + + + public void SetInstanceKey(string instanceKey) + { + _instanceKey = instanceKey; + } + + protected override string getPropertyValue(string Key) + { + return _properties[Key]; + } + + protected override InstanceMemento getChild(string Key) + { + return (InstanceMemento) _children[Key]; + } + + /// <summary> + /// See <cref>InstanceMemento</cref> + /// </summary> + public override bool IsReference + { + get { return _isReference; } + } + + /// <summary> + /// See <cref>InstanceMemento</cref> + /// </summary> + public override string ReferenceKey + { + get { return _referenceKey; } + } + + + protected bool hasProperty(string propertyName) + { + return _properties[propertyName] != null; + } + + + /// <summary> + /// See <cref>InstanceMemento</cref> + /// </summary> + public override InstanceMemento[] GetChildrenArray(string key) + { + return (InstanceMemento[]) _children[key]; + } + + #endregion + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/PrototypeMemento.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/Mementos/PrototypeMemento.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -0,0 +1,63 @@ +using System; + +namespace StructureMap.Configuration.Mementos +{ + public class PrototypeMemento : InstanceMemento + { + private readonly string _instanceKey; + private ICloneable _prototype; + + public PrototypeMemento(string instanceKey, ICloneable prototype) + { + _instanceKey = instanceKey; + _prototype = prototype; + } + + + public ICloneable Prototype + { + get { return _prototype; } + set { _prototype = value; } + } + + protected override object buildInstance(IInstanceCreator creator) + { + return _prototype.Clone(); + } + + protected override string innerConcreteKey + { + get { return string.Empty; } + } + + protected override string innerInstanceKey + { + get { return _instanceKey; } + } + + protected override string getPropertyValue(string Key) + { + throw new NotImplementedException(); + } + + protected override InstanceMemento getChild(string Key) + { + throw new NotImplementedException(); + } + + public override InstanceMemento[] GetChildrenArray(string Key) + { + throw new NotImplementedException(); + } + + public override bool IsReference + { + get { return false; } + } + + public override string ReferenceKey + { + get { throw new NotImplementedException(); } + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs (from rev 53, trunk/Source/StructureMap/Configuration/UserControlMemento.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/Mementos/UserControlMemento.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -0,0 +1,68 @@ +using System; +using System.Web.UI; + +namespace StructureMap.Configuration.Mementos +{ + public class UserControlMemento : InstanceMemento + { + private readonly string _instanceKey; + private string _url; + + public UserControlMemento(string instanceKey, string url) + { + _instanceKey = instanceKey; + _url = url; + } + + + public UserControlMemento() + { + } + + public string Url + { + get { return _url; } + set { _url = value; } + } + + protected override object buildInstance(IInstanceCreator creator) + { + return new Page().LoadControl(_url); + } + + protected override string innerConcreteKey + { + get { return string.Empty; } + } + + protected override string innerInstanceKey + { + get { return _instanceKey; } + } + + protected override string getPropertyValue(string Key) + { + throw new NotImplementedException(); + } + + protected override InstanceMemento getChild(string Key) + { + throw new NotImplementedException(); + } + + public override InstanceMemento[] GetChildrenArray(string Key) + { + throw new NotImplementedException(); + } + + public override bool IsReference + { + get { return false; } + } + + public override string ReferenceKey + { + get { throw new NotImplementedException(); } + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/ConstructorMemento.cs =================================================================== --- trunk/Source/StructureMap/ConstructorMemento.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/ConstructorMemento.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; namespace StructureMap { Modified: trunk/Source/StructureMap/Graph/Plugin.cs =================================================================== --- trunk/Source/StructureMap/Graph/Plugin.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/Graph/Plugin.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Reflection; +using StructureMap.Configuration.Mementos; namespace StructureMap.Graph { Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Reflection; -using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Emitting; using StructureMap.Graph; using StructureMap.Interceptors; Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,7 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; -using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Exceptions; using StructureMap.Graph; using StructureMap.Interceptors; Deleted: trunk/Source/StructureMap/MemoryInstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/MemoryInstanceMemento.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/MemoryInstanceMemento.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,209 +0,0 @@ -using System.Collections; -using System.Collections.Specialized; -using StructureMap.Graph; - -namespace StructureMap -{ - public class GenericMemento<T> : MemoryInstanceMemento - { - public GenericMemento(string instanceKey) - : base(Plugin.CreateImplicitPlugin(typeof (T)).ConcreteKey, instanceKey) - { - } - } - - /// <summary> - /// An in-memory implementation of InstanceMemento. - /// </summary> - public class MemoryInstanceMemento : InstanceMemento - { - #region statics - - /// <summary> - /// Creates an instance of MemoryInstanceMemento that represents a reference to another - /// instance. - /// </summary> - /// <param name="referenceKey">The referenced instance key to another instance</param> - /// <returns></returns> - public static MemoryInstanceMemento CreateReferencedInstanceMemento(string referenceKey) - { - MemoryInstanceMemento memento = new MemoryInstanceMemento(); - memento._referenceKey = referenceKey; - memento._isReference = true; - - return memento; - } - - /// <summary> - /// Creates a MemoryInstanceMemento that represents a reference to the default instance - /// of a plugin type. - /// </summary> - /// <returns></returns> - public static MemoryInstanceMemento CreateDefaultInstanceMemento() - { - MemoryInstanceMemento memento = new MemoryInstanceMemento(); - memento._referenceKey = string.Empty; - memento._isReference = true; - - return memento; - } - - #endregion - - private NameValueCollection _properties = new NameValueCollection(); - private Hashtable _children = new Hashtable(); - private string _concreteKey; - private string _instanceKey; - private bool _isReference; - private string _referenceKey; - - - /// <summary> - /// Constructs a MemoryInstanceMemento without properties - /// </summary> - /// <param name="concreteKey">The concrete key of the plugin type</param> - /// <param name="instanceKey">The identifying instance key</param> - public MemoryInstanceMemento(string concreteKey, string instanceKey) - : this(concreteKey, instanceKey, new NameValueCollection()) - { - } - - - /// <summary> - /// Constructs a MemoryInstanceMemento with properties - /// </summary> - /// <param name="concreteKey">The concrete key of the plugin type</param> - /// <param name="instanceKey">The identifying instance key</param> - /// <param name="properties">NameValueCollection of instance properties</param> - public MemoryInstanceMemento(string concreteKey, string instanceKey, NameValueCollection properties) - { - _properties = properties; - _concreteKey = concreteKey; - _instanceKey = instanceKey; - } - - - public MemoryInstanceMemento() - { - } - - /// <summary> - /// Sets the value of the named property - /// </summary> - /// <param name="name"></param> - /// <param name="value"></param> - public void SetProperty(string name, string value) - { - string stringValue = value == string.Empty ? EMPTY_STRING : value; - _properties[name] = stringValue; - } - - public void SetTemplateKey(string templateName) - { - SetProperty(TEMPLATE_ATTRIBUTE, templateName); - } - - /// <summary> - /// Deletes a named property from the DefaultInstanceMemento - /// </summary> - /// <param name="Name"></param> - public void RemoveProperty(string Name) - { - _properties.Remove(Name); - } - - /// <summary> - /// Links a child InstanceMemento as a named property - /// </summary> - /// <param name="name"></param> - /// <param name="Memento"></param> - public void AddChild(string name, InstanceMemento Memento) - { - _children.Add(name, Memento); - } - - public void ReferenceChild(string name, string instanceKey) - { - InstanceMemento child = CreateReferencedInstanceMemento(instanceKey); - AddChild(name, child); - } - - - /// <summary> - /// Links an array of InstanceMemento's to a named array property - /// </summary> - /// <param name="name"></param> - /// <param name="childMementos"></param> - public void AddChildArray(string name, InstanceMemento[] childMementos) - { - _children.Add(name, childMementos); - } - - #region InstanceMemento Members - - /// <summary> - /// See <cref>InstanceMemento</cref> - /// </summary> - protected override string innerConcreteKey - { - get { return _concreteKey; } - } - - /// <summary> - /// See <cref>InstanceMemento</cref> - /// </summary> - protected override string innerInstanceKey - { - get { return _instanceKey; } - } - - - public void SetInstanceKey(string instanceKey) - { - _instanceKey = instanceKey; - } - - protected override string getPropertyValue(string Key) - { - return _properties[Key]; - } - - protected override InstanceMemento getChild(string Key) - { - return (InstanceMemento) _children[Key]; - } - - /// <summary> - /// See <cref>InstanceMemento</cref> - /// </summary> - public override bool IsReference - { - get { return _isReference; } - } - - /// <summary> - /// See <cref>InstanceMemento</cref> - /// </summary> - public override string ReferenceKey - { - get { return _referenceKey; } - } - - - protected bool hasProperty(string propertyName) - { - return _properties[propertyName] != null; - } - - - /// <summary> - /// See <cref>InstanceMemento</cref> - /// </summary> - public override InstanceMemento[] GetChildrenArray(string key) - { - return (InstanceMemento[]) _children[key]; - } - - #endregion - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap/ObjectFactory.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Security.Permissions; using System.Text; -using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap Modified: trunk/Source/StructureMap.Testing/Client/Controllers/TreeBuilderTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Client/Controllers/TreeBuilderTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Client/Controllers/TreeBuilderTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -4,6 +4,7 @@ using StructureMap.Client.TreeNodes; using StructureMap.Client.Views; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Configuration.Tokens.Properties; using StructureMap.Graph; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,7 @@ using NUnit.Framework; using StructureMap.Configuration.DSL; using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Testing.Widget4; namespace StructureMap.Testing.Configuration.DSL Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/DeepInstanceTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,5 +1,6 @@ using NUnit.Framework; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Testing.Widget; namespace StructureMap.Testing.Configuration.DSL Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,5 +1,6 @@ using NUnit.Framework; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Testing.Widget; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,7 @@ using NUnit.Framework; using StructureMap.Configuration.DSL; using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Testing.Widget; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/ProfileExpressionTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,5 +1,6 @@ using NUnit.Framework; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Testing.Widget; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,8 +1,8 @@ using System; using NUnit.Framework; using Rhino.Mocks; -using StructureMap.Configuration; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Testing.Widget3; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,6 @@ using NUnit.Framework; -using StructureMap.Configuration; using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; namespace StructureMap.Testing.Configuration.DSL Modified: trunk/Source/StructureMap.Testing/Configuration/DiagnosticGraphBuilderTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DiagnosticGraphBuilderTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/DiagnosticGraphBuilderTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -4,6 +4,7 @@ using StructureMap.Attributes; using StructureMap.Configuration; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Graph; using StructureMap.Testing.Configuration.Tokens; Modified: trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/InlineInstanceDefinitionInProfileAndMachineNodesTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,5 +1,6 @@ using System.Diagnostics; using NUnit.Framework; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Testing.TestData; using StructureMap.Testing.Widget; Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/FamilyTokenTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/FamilyTokenTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/FamilyTokenTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -2,6 +2,7 @@ using NUnit.Framework; using StructureMap.Attributes; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Graph; using StructureMap.Source; Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/InstanceTokenTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/InstanceTokenTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/InstanceTokenTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -2,6 +2,7 @@ using NMock; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Configuration.Tokens.Properties; using StructureMap.Graph; Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/MockInterceptor.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/MockInterceptor.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/MockInterceptor.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; using StructureMap.Interceptors; namespace StructureMap.Testing.Configuration.Tokens Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/MockMementoSource.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/MockMementoSource.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/MockMementoSource.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; namespace StructureMap.Testing.Configuration.Tokens { Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildArrayPropertyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildArrayPropertyTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildArrayPropertyTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -2,6 +2,7 @@ using NMock; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Configuration.Tokens.Properties; using StructureMap.Testing.Widget3; Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildPropertyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildPropertyTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/ChildPropertyTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,7 @@ using NMock; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Configuration.Tokens.Properties; using StructureMap.Testing.Widget3; Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/EnumerationPropertyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/EnumerationPropertyTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/EnumerationPropertyTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -2,6 +2,7 @@ using NUnit.Framework; using StructureMap.Attributes; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Configuration.Tokens.Properties; Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/PrimitivePropertyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/PrimitivePropertyTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/Properties/PrimitivePropertyTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,7 @@ using NMock; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Configuration.Tokens.Properties; Modified: trunk/Source/StructureMap.Testing/Configuration/Tokens/PropertyDefinitionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/Tokens/PropertyDefinitionTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Configuration/Tokens/PropertyDefinitionTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -4,6 +4,7 @@ using System.Xml; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Configuration.Tokens.Properties; Modified: trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -3,7 +3,7 @@ using System.Collections.Generic; using NUnit.Framework; using Rhino.Mocks; -using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Testing.Widget3; Modified: trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Container/EnumerationTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using NUnit.Framework; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Source; using StructureMap.Testing.Widget2; Modified: trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using NUnit.Framework; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Source; Modified: trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Container/InstanceManagerTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,5 +1,6 @@ using System; using NUnit.Framework; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Source; Modified: trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,7 @@ using System.Xml; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Source; Modified: trunk/Source/StructureMap.Testing/Container/Source/XmlTemplaterTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/Source/XmlTemplaterTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/Container/Source/XmlTemplaterTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,6 +1,7 @@ using System.Collections; using System.Xml; using NUnit.Framework; +using StructureMap.Configuration.Mementos; using StructureMap.Source; using StructureMap.Testing.TestData; using StructureMap.Testing.XmlWriting; Modified: trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/GenericsAcceptanceTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -3,6 +3,7 @@ using System.Reflection; using NUnit.Framework; using StructureMap.Configuration; +using StructureMap.Configuration.Mementos; using StructureMap.Configuration.Tokens; using StructureMap.Graph; using StructureMap.Testing.GenericWidgets; Modified: trunk/Source/StructureMap.Testing/ImplicitPluginFromPluggedTypeAttributeTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/ImplicitPluginFromPluggedTypeAttributeTester.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing/ImplicitPluginFromPluggedTypeAttributeTester.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -4,6 +4,7 @@ using StructureMap.Attributes; using StructureMap.Configuration; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.Mementos; using StructureMap.Graph; using StructureMap.Testing.TestData; using StructureMap.Testing.Widget; Modified: trunk/Source/StructureMap.Testing.Widget/Rule.cs =================================================================== --- trunk/Source/StructureMap.Testing.Widget/Rule.cs 2008-01-14 04:18:06 UTC (rev 54) +++ trunk/Source/StructureMap.Testing.Widget/Rule.cs 2008-01-14 04:24:37 UTC (rev 55) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.Mementos; namespace ... [truncated message content] |
From: <jer...@us...> - 2008-01-14 04:18:10
|
Revision: 54 http://structuremap.svn.sourceforge.net/structuremap/?rev=54&view=rev Author: jeremydmiller Date: 2008-01-13 20:18:06 -0800 (Sun, 13 Jan 2008) Log Message: ----------- moving code around Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/ObjectFactory.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap/StructureMapConfiguration.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs Added Paths: ----------- trunk/Source/StructureMap/Configuration/DSL/Expressions/ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/ChildArrayExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildArrayExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,50 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + public class ChildArrayExpression<PLUGINTYPE> : IExpression + { + private readonly InstanceExpression _parent; + private readonly MemoryInstanceMemento _memento; + private readonly string _propertyName; + private IMementoBuilder[] _builders; + private Type _pluginType = typeof (PLUGINTYPE); + + public ChildArrayExpression(InstanceExpression parent, MemoryInstanceMemento memento, string propertyName) + { + _parent = parent; + _memento = memento; + _propertyName = propertyName; + + _pluginType = typeof (PLUGINTYPE).GetElementType(); + } + + void IExpression.Configure(PluginGraph graph) + { + PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); + InstanceMemento[] childMementos = new InstanceMemento[_builders.Length]; + for (int i = 0; i < _builders.Length; i++) + { + InstanceMemento memento = processMementoBuilder(_builders[i], family, graph); + childMementos[i] = memento; + } + + _memento.AddChildArray(_propertyName, childMementos); + } + + private InstanceMemento processMementoBuilder(IMementoBuilder builder, PluginFamily family, PluginGraph graph) + { + builder.ValidatePluggability(_pluginType); + builder.Configure(graph); + return builder.BuildMemento(family); + } + + public InstanceExpression Contains(params IMementoBuilder[] builders) + { + _builders = builders; + + return _parent; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ChildInstanceExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Part of the Fluent Interface, represents a nonprimitive argument to a + /// constructure function + /// </summary> + public class ChildInstanceExpression : IExpression + { + private readonly InstanceExpression _instance; + private readonly MemoryInstanceMemento _memento; + private readonly string _propertyName; + private Type _childType; + private List<IExpression> _children = new List<IExpression>(); + private IMementoBuilder _builder; + + + public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName) + { + _instance = instance; + _memento = memento; + _propertyName = propertyName; + } + + public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName, + Type childType) + : this(instance, memento, propertyName) + { + _childType = childType; + } + + /// <summary> + /// Use a previously configured and named instance for the child + /// </summary> + /// <param name="instanceKey"></param> + /// <returns></returns> + public InstanceExpression IsNamedInstance(string instanceKey) + { + MemoryInstanceMemento child = MemoryInstanceMemento.CreateReferencedInstanceMemento(instanceKey); + _memento.AddChild(_propertyName, child); + + return _instance; + } + + /// <summary> + /// Start the definition of a child instance by defining the concrete type + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public InstanceExpression IsConcreteType<T>() + { + Type pluggedType = typeof (T); + ExpressionValidator.ValidatePluggabilityOf(pluggedType).IntoPluginType(_childType); + + + InstanceExpression child = new InstanceExpression(_childType); + child.TypeExpression().UsingConcreteType<T>(); + _children.Add(child); + + _builder = child; + + return _instance; + } + + + void IExpression.Configure(PluginGraph graph) + { + if (_childType == null) + { + return; + } + + PluginFamily family = graph.LocateOrCreateFamilyForType(_childType); + if (_builder != null) + { + InstanceMemento childMemento = _builder.BuildMemento(family); + _memento.AddChild(_propertyName, childMemento); + } + + foreach (IExpression child in _children) + { + child.Configure(graph); + } + } + + internal Type ChildType + { + set { _childType = value; } + } + + /// <summary> + /// Registers a configured instance to use as the argument to the parent's + /// constructor + /// </summary> + /// <param name="child"></param> + /// <returns></returns> + public InstanceExpression Is(InstanceExpression child) + { + if (child.PluggedType != null && _childType != null) + { + ExpressionValidator.ValidatePluggabilityOf(child.PluggedType).IntoPluginType(_childType); + } + + _children.Add(child); + MemoryInstanceMemento childMemento = + MemoryInstanceMemento.CreateReferencedInstanceMemento(child.InstanceKey); + _memento.AddChild(_propertyName, childMemento); + + return _instance; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/ConstructorExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ConstructorExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,49 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + public class ConstructorExpression<PLUGINTYPE> : MementoBuilder<ConstructorExpression<PLUGINTYPE>> + { + private ConstructorMemento<PLUGINTYPE> _memento; + + public ConstructorExpression(BuildObjectDelegate<PLUGINTYPE> builder) + : base(typeof (PLUGINTYPE)) + { + _memento.Builder = builder; + } + + + protected override InstanceMemento memento + { + get { return _memento; } + } + + protected override ConstructorExpression<PLUGINTYPE> thisInstance + { + get { return this; } + } + + protected override void configureMemento(PluginFamily family) + { + } + + protected override void validate() + { + } + + protected override void buildMemento() + { + _memento = new ConstructorMemento<PLUGINTYPE>(); + } + + public override void ValidatePluggability(Type pluginType) + { + if (!pluginType.Equals(typeof (PLUGINTYPE))) + { + throw new StructureMapException(306, + typeof (PLUGINTYPE).FullName, pluginType.FullName); + } + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/CreatePluginFamilyExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using StructureMap.Attributes; +using StructureMap.Graph; +using StructureMap.Interceptors; + +namespace StructureMap.Configuration.DSL.Expressions +{ + public delegate void AlterPluginFamilyDelegate(PluginFamily family); + + /// <summary> + /// Represents the parameters for creating instances of a given Type + /// </summary> + public class CreatePluginFamilyExpression<PLUGINTYPE> : IExpression + { + private readonly Type _pluginType; + private readonly List<AlterPluginFamilyDelegate> _alterations = new List<AlterPluginFamilyDelegate>(); + private readonly InstanceScope _scope = InstanceScope.PerRequest; + private readonly List<IExpression> _children = new List<IExpression>(); + + public CreatePluginFamilyExpression() + { + _pluginType = typeof (PLUGINTYPE); + } + + void IExpression.Configure(PluginGraph graph) + { + PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType); + InterceptorChainBuilder builder = new InterceptorChainBuilder(); + family.InterceptionChain = builder.Build(_scope); + + foreach (IExpression child in _children) + { + child.Configure(graph); + } + + foreach (AlterPluginFamilyDelegate alteration in _alterations) + { + alteration(family); + } + + graph.PluginFamilies.Add(family); + + AssemblyGraph assembly = new AssemblyGraph(_pluginType.Assembly); + graph.Assemblies.Add(assembly); + } + + /// <summary> + /// Sets the default instance of a Type to the definition represented by builder + /// </summary> + /// <param name="builder"></param> + /// <returns></returns> + public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIs(IMementoBuilder builder) + { + builder.ValidatePluggability(_pluginType); + + _children.Add(builder); + _alterations.Add(delegate(PluginFamily family) + { + InstanceMemento memento = builder.BuildMemento(family); + family.Source.AddExternalMemento(memento); + family.DefaultInstanceKey = memento.InstanceKey; + }); + + return this; + } + + public CreatePluginFamilyExpression<PLUGINTYPE> AddInstance(IMementoBuilder builder) + { + builder.ValidatePluggability(_pluginType); + + _children.Add(builder); + _alterations.Add(delegate(PluginFamily family) + { + InstanceMemento memento = builder.BuildMemento(family); + family.Source.AddExternalMemento(memento); + }); + + return this; + } + + /// <summary> + /// Convenience method that sets the default concrete type of the PluginType. Type T + /// can only accept types that do not have any primitive constructor arguments. + /// StructureMap has to know how to construct all of the constructor argument types. + /// </summary> + /// <typeparam name="CONCRETETYPE"></typeparam> + /// <returns></returns> + public CreatePluginFamilyExpression<PLUGINTYPE> TheDefaultIsConcreteType<CONCRETETYPE>() + where CONCRETETYPE : PLUGINTYPE + { + ExpressionValidator.ValidatePluggabilityOf(typeof (CONCRETETYPE)).IntoPluginType(_pluginType); + + _alterations.Add(delegate(PluginFamily family) + { + Plugin plugin = family.Plugins.FindOrCreate(typeof (CONCRETETYPE)); + family.DefaultInstanceKey = plugin.ConcreteKey; + }); + + return this; + } + + /// <summary> + /// Sets the object creation of the instances of the PluginType. For example: PerRequest, + /// Singleton, ThreadLocal, HttpContext, or Hybrid + /// </summary> + /// <param name="scope"></param> + /// <returns></returns> + public CreatePluginFamilyExpression<PLUGINTYPE> CacheBy(InstanceScope scope) + { + _alterations.Add(delegate(PluginFamily family) + { + InterceptorChainBuilder builder = new InterceptorChainBuilder(); + family.InterceptionChain = builder.Build(scope); + }); + + return this; + } + + /// <summary> + /// Convenience method to mark a PluginFamily as a Singleton + /// </summary> + /// <returns></returns> + public CreatePluginFamilyExpression<PLUGINTYPE> AsSingletons() + { + _alterations.Add( + delegate(PluginFamily family) { family.InterceptionChain.AddInterceptor(new SingletonInterceptor()); }); + return this; + } + + + public CreatePluginFamilyExpression<PLUGINTYPE> OnCreation(StartupHandler<PLUGINTYPE> handler) + { + _alterations.Add( + delegate(PluginFamily family) { family.InstanceInterceptor = new StartupInterceptor<PLUGINTYPE>(handler); }); + + return this; + } + + public CreatePluginFamilyExpression<PLUGINTYPE> EnrichWith(EnrichmentHandler<PLUGINTYPE> handler) + { + _alterations.Add( + delegate(PluginFamily family) { family.InstanceInterceptor = new EnrichmentInterceptor<PLUGINTYPE>(handler); }); + + return this; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/IMementoBuilder.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/IMementoBuilder.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,14 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + public interface IMementoBuilder : IExpression + { + InstanceMemento BuildMemento(PluginFamily family); + InstanceMemento BuildMemento(PluginGraph graph); + void SetInstanceName(string instanceKey); + + void ValidatePluggability(Type pluginType); + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/InstanceDefaultExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/InstanceDefaultExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,70 @@ +using System; +using StructureMap.Configuration.DSL.Expressions; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Use to express the instance of a PluginType for the containing Profile + /// </summary> + public class InstanceDefaultExpression + { + private readonly Type _pluginType; + private readonly ProfileExpression _parent; + private string _instanceKey = string.Empty; + private IMementoBuilder _mementoBuilder; + + public InstanceDefaultExpression(Type pluginType, ProfileExpression parent) + { + _pluginType = pluginType; + _parent = parent; + } + + /// <summary> + /// Use a named, preconfigured instance as the default instance for this profile + /// </summary> + /// <param name="instanceKey"></param> + /// <returns></returns> + public ProfileExpression UseNamedInstance(string instanceKey) + { + _instanceKey = instanceKey; + return _parent; + } + + internal void Configure(Profile profile, PluginGraph graph) + { + if (!string.IsNullOrEmpty(_instanceKey)) + { + InstanceDefault instanceDefault = new InstanceDefault(_pluginType, _instanceKey); + profile.AddOverride(instanceDefault); + } + else if (_mementoBuilder != null) + { + string defaultKey = Profile.InstanceKeyForProfile(profile.ProfileName); + InstanceMemento memento = _mementoBuilder.BuildMemento(graph); + memento.InstanceKey = defaultKey; + + graph.PluginFamilies[_pluginType].AddInstance(memento); + + InstanceDefault instanceDefault = new InstanceDefault(_pluginType, defaultKey); + profile.AddOverride(instanceDefault); + } + else + { + throw new StructureMapException(304, TypePath.GetAssemblyQualifiedName(_pluginType)); + } + } + + /// <summary> + /// Define the default instance of the PluginType for the containing Profile + /// </summary> + /// <param name="mementoBuilder"></param> + /// <returns></returns> + public ProfileExpression Use(IMementoBuilder mementoBuilder) + { + _mementoBuilder = mementoBuilder; + + return _parent; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/LiteralExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,50 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Small helper class to represent an object to be plugged into a PluginType as is + /// </summary> + /// <typeparam name="T"></typeparam> + public class LiteralExpression<T> : MementoBuilder<LiteralExpression<T>> + { + private readonly T _target; + private LiteralMemento _memento; + + public LiteralExpression(T target) : base(typeof (T)) + { + _target = target; + } + + + protected override InstanceMemento memento + { + get { return _memento; } + } + + protected override LiteralExpression<T> thisInstance + { + get { return this; } + } + + protected override void configureMemento(PluginFamily family) + { + _memento.Instance = _target; + } + + protected override void validate() + { + } + + protected override void buildMemento() + { + _memento = new LiteralMemento(null); + } + + public override void ValidatePluggability(Type pluginType) + { + ExpressionValidator.ValidatePluggabilityOf(_target.GetType()).IntoPluginType(pluginType); + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/LiteralMemento.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/LiteralMemento.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,67 @@ +using System; + +namespace StructureMap.Configuration.DSL.Expressions +{ + public class LiteralMemento : InstanceMemento + { + private object _instance; + + public LiteralMemento(object instance) + { + _instance = instance; + InstanceKey = Guid.NewGuid().ToString(); + } + + public LiteralMemento Named(string name) + { + InstanceKey = name; + return this; + } + + public object Instance + { + get { return _instance; } + set { _instance = value; } + } + + protected override string innerConcreteKey + { + get { throw new NotImplementedException(); } + } + + protected override string innerInstanceKey + { + get { throw new NotImplementedException(); } + } + + protected override string getPropertyValue(string Key) + { + throw new NotImplementedException(); + } + + protected override InstanceMemento getChild(string Key) + { + throw new NotImplementedException(); + } + + public override InstanceMemento[] GetChildrenArray(string Key) + { + throw new NotImplementedException(); + } + + public override bool IsReference + { + get { return false; } + } + + public override string ReferenceKey + { + get { throw new NotImplementedException(); } + } + + protected override object buildInstance(IInstanceCreator creator) + { + return _instance; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/PropertyExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,45 @@ +using System.Configuration; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Defines the value of a primitive argument to a constructur argument + /// </summary> + public class PropertyExpression + { + private readonly InstanceExpression _instance; + private readonly MemoryInstanceMemento _memento; + private readonly string _propertyName; + + public PropertyExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName) + { + _instance = instance; + _memento = memento; + _propertyName = propertyName; + } + + /// <summary> + /// Sets the value of the constructor argument + /// </summary> + /// <param name="propertyValue"></param> + /// <returns></returns> + public InstanceExpression EqualTo(object propertyValue) + { + _memento.SetProperty(_propertyName, propertyValue.ToString()); + return _instance; + } + + /// <summary> + /// Sets the value of the constructor argument to the key/value in the + /// AppSettings + /// </summary> + /// <param name="appSettingKey"></param> + /// <returns></returns> + public InstanceExpression EqualToAppSetting(string appSettingKey) + { + string propertyValue = ConfigurationManager.AppSettings[appSettingKey]; + _memento.SetProperty(_propertyName, propertyValue); + return _instance; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/PrototypeExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,50 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Sets up a Prototype instance of type T + /// </summary> + /// <typeparam name="T"></typeparam> + public class PrototypeExpression<T> : MementoBuilder<PrototypeExpression<T>> + { + private readonly T _prototype; + private PrototypeMemento _memento; + + public PrototypeExpression(T prototype) : base(typeof (T)) + { + _prototype = prototype; + } + + protected override InstanceMemento memento + { + get { return _memento; } + } + + protected override PrototypeExpression<T> thisInstance + { + get { return this; } + } + + protected override void configureMemento(PluginFamily family) + { + _memento.Prototype = (ICloneable) _prototype; + } + + protected override void validate() + { + // TODO + } + + protected override void buildMemento() + { + _memento = new PrototypeMemento(string.Empty, (ICloneable) _prototype); + } + + public override void ValidatePluggability(Type pluginType) + { + ExpressionValidator.ValidatePluggabilityOf(_prototype.GetType()).IntoPluginType(pluginType); + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/ScanAssembliesExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection; +using System.Threading; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + /// <summary> + /// Expression that directs StructureMap to scan the named assemblies + /// for [PluginFamily] and [Plugin] attributes + /// </summary> + public class ScanAssembliesExpression : IExpression + { + private List<AssemblyGraph> _assemblies = new List<AssemblyGraph>(); + + void IExpression.Configure(PluginGraph graph) + { + foreach (AssemblyGraph assembly in _assemblies) + { + graph.Assemblies.Add(assembly); + } + } + + public ScanAssembliesExpression IncludeTheCallingAssembly() + { + Assembly callingAssembly = findTheCallingAssembly(); + + if (callingAssembly != null) + { + _assemblies.Add(new AssemblyGraph(callingAssembly)); + } + + return this; + } + + private static Assembly findTheCallingAssembly() + { + StackTrace trace = new StackTrace(Thread.CurrentThread, false); + + Assembly thisAssembly = Assembly.GetExecutingAssembly(); + Assembly callingAssembly = null; + for (int i = 0; i < trace.FrameCount; i++) + { + StackFrame frame = trace.GetFrame(i); + Assembly assembly = frame.GetMethod().DeclaringType.Assembly; + if (assembly != thisAssembly) + { + callingAssembly = assembly; + break; + } + } + return callingAssembly; + } + + public ScanAssembliesExpression IncludeAssemblyContainingType<T>() + { + _assemblies.Add(AssemblyGraph.ContainingType<T>()); + + return this; + } + } +} \ No newline at end of file Copied: trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs (from rev 53, trunk/Source/StructureMap/Configuration/DSL/UserControlExpression.cs) =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs (rev 0) +++ trunk/Source/StructureMap/Configuration/DSL/Expressions/UserControlExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -0,0 +1,45 @@ +using System; +using StructureMap.Graph; + +namespace StructureMap.Configuration.DSL.Expressions +{ + public class UserControlExpression : MementoBuilder<UserControlExpression> + { + private UserControlMemento _memento; + + public UserControlExpression(Type pluginType, string url) : base(pluginType) + { + _memento.Url = url; + } + + protected override InstanceMemento memento + { + get { return _memento; } + } + + protected override UserControlExpression thisInstance + { + get { return this; } + } + + protected override void configureMemento(PluginFamily family) + { + // no-op + } + + protected override void validate() + { + // no-op + } + + protected override void buildMemento() + { + _memento = new UserControlMemento(); + } + + public override void ValidatePluggability(Type pluginType) + { + // no-op + } + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; namespace StructureMap.Configuration.DSL Modified: trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Interceptors; Modified: trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,4 +1,5 @@ using System.Collections.Generic; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; namespace StructureMap.Configuration.DSL Modified: trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/Configuration/DSL/ReferenceMementoBuilder.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,4 +1,5 @@ using System; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; namespace StructureMap.Configuration.DSL Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Interceptors; Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Data; using System.Reflection; -using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Emitting; using StructureMap.Graph; using StructureMap.Interceptors; Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,7 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; -using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Exceptions; using StructureMap.Graph; using StructureMap.Interceptors; Modified: trunk/Source/StructureMap/ObjectFactory.cs =================================================================== --- trunk/Source/StructureMap/ObjectFactory.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/ObjectFactory.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Security.Permissions; using System.Text; -using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; namespace StructureMap Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-01-14 04:18:06 UTC (rev 54) @@ -209,26 +209,26 @@ <Compile Include="Configuration\DiagnosticGraphBuilder.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Configuration\DSL\ChildArrayExpression.cs" /> - <Compile Include="Configuration\DSL\ChildInstanceExpression.cs" /> - <Compile Include="Configuration\DSL\ConstructorExpression.cs" /> - <Compile Include="Configuration\DSL\CreatePluginFamilyExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\ChildArrayExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\ChildInstanceExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\ConstructorExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\CreatePluginFamilyExpression.cs" /> <Compile Include="Configuration\DSL\ExpressionValidator.cs" /> <Compile Include="Configuration\DSL\IExpression.cs" /> - <Compile Include="Configuration\DSL\IMementoBuilder.cs" /> - <Compile Include="Configuration\DSL\InstanceDefaultExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\IMementoBuilder.cs" /> + <Compile Include="Configuration\DSL\Expressions\InstanceDefaultExpression.cs" /> <Compile Include="Configuration\DSL\InstanceExpression.cs" /> - <Compile Include="Configuration\DSL\LiteralExpression.cs" /> - <Compile Include="Configuration\DSL\LiteralMemento.cs" /> + <Compile Include="Configuration\DSL\Expressions\LiteralExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\LiteralMemento.cs" /> <Compile Include="Configuration\DSL\MementoBuilder.cs" /> <Compile Include="Configuration\DSL\ProfileExpression.cs" /> - <Compile Include="Configuration\DSL\PropertyExpression.cs" /> - <Compile Include="Configuration\DSL\PrototypeExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\PropertyExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\PrototypeExpression.cs" /> <Compile Include="Configuration\DSL\PrototypeMemento.cs" /> <Compile Include="Configuration\DSL\ReferenceMementoBuilder.cs" /> <Compile Include="Configuration\DSL\Registry.cs" /> - <Compile Include="Configuration\DSL\ScanAssembliesExpression.cs" /> - <Compile Include="Configuration\DSL\UserControlExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\ScanAssembliesExpression.cs" /> + <Compile Include="Configuration\DSL\Expressions\UserControlExpression.cs" /> <Compile Include="Configuration\FamilyParser.cs"> <SubType>Code</SubType> </Compile> Modified: trunk/Source/StructureMap/StructureMapConfiguration.cs =================================================================== --- trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap/StructureMapConfiguration.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -4,6 +4,7 @@ using System.Xml; using StructureMap.Configuration; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Verification; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/ChildInstanceExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,5 +1,6 @@ using NUnit.Framework; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Testing.Widget4; namespace StructureMap.Testing.Configuration.DSL Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,6 +1,7 @@ using NUnit.Framework; using StructureMap.Attributes; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Testing.Widget; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/LiteralExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,5 +1,6 @@ using NUnit.Framework; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Testing.Widget; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/ReferenceMementoBuilderTester.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,6 +1,7 @@ using NUnit.Framework; using Rhino.Mocks; using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Testing.Container; Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap.Testing/Configuration/DSL/UserControlExpressionTester.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -1,6 +1,6 @@ using NUnit.Framework; using StructureMap.Configuration; -using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; namespace StructureMap.Testing.Configuration.DSL Modified: trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs 2008-01-14 03:57:47 UTC (rev 53) +++ trunk/Source/StructureMap.Testing/Container/DynamicInjectionTester.cs 2008-01-14 04:18:06 UTC (rev 54) @@ -3,7 +3,7 @@ using System.Collections.Generic; using NUnit.Framework; using Rhino.Mocks; -using StructureMap.Configuration.DSL; +using StructureMap.Configuration.DSL.Expressions; using StructureMap.Graph; using StructureMap.Interceptors; using StructureMap.Testing.Widget3; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-14 03:57:50
|
Revision: 53 http://structuremap.svn.sourceforge.net/structuremap/?rev=53&view=rev Author: jeremydmiller Date: 2008-01-13 19:57:47 -0800 (Sun, 13 Jan 2008) Log Message: ----------- type interception for some AOP support Modified Paths: -------------- trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs trunk/Source/StructureMap/Configuration/DSL/Registry.cs trunk/Source/StructureMap/Graph/PluginGraph.cs trunk/Source/StructureMap/IInstanceFactory.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap/InstanceMemento.cs trunk/Source/StructureMap/StructureMap.csproj trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs trunk/Source/StructureMap.Testing/InstanceMementoTester.cs trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj Added Paths: ----------- trunk/Source/StructureMap/Interceptors/CompoundInterceptor.cs trunk/Source/StructureMap/Interceptors/EnrichmentInterceptor.cs trunk/Source/StructureMap/Interceptors/InstanceInterceptor.cs trunk/Source/StructureMap/Interceptors/InterceptorLibrary.cs trunk/Source/StructureMap/Interceptors/Interceptors.cs trunk/Source/StructureMap/Interceptors/NulloInterceptor.cs trunk/Source/StructureMap/Interceptors/StartupInterceptor.cs trunk/Source/StructureMap/Interceptors/TypeInterceptor.cs trunk/Source/StructureMap.Testing/Container/Interceptors/CompoundInterceptorTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/InterceptorLibraryTester.cs trunk/Source/StructureMap.Testing/Container/Interceptors/MockTypeInterceptor.cs trunk/Source/StructureMap.Testing/Container/Interceptors/TypeInterceptionTester.cs Removed Paths: ------------- trunk/Source/StructureMap/Delegates.cs Modified: trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/Configuration/DSL/MementoBuilder.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using StructureMap.Graph; +using StructureMap.Interceptors; namespace StructureMap.Configuration.DSL { Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs =================================================================== --- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using StructureMap.Graph; +using StructureMap.Interceptors; namespace StructureMap.Configuration.DSL { @@ -34,6 +35,11 @@ _expressions.Add(expression); } + internal void addExpression(PluginGraphAlteration alteration) + { + _expressions.Add(new BasicExpression(alteration)); + } + internal void ConfigurePluginGraph(PluginGraph graph) { foreach (IExpression expression in _expressions) @@ -222,5 +228,70 @@ { return new ReferenceMementoBuilder(referencedKey); } + + public void RegisterInterceptor(TypeInterceptor interceptor) + { + addExpression(delegate (PluginGraph pluginGraph) + { + pluginGraph.InterceptorLibrary.AddInterceptor(interceptor); + }); + } + + public TypeInterceptorExpression IfTypeMatches(TypeMatchDelegate match) + { + TypeInterceptorExpression expression = new TypeInterceptorExpression(match); + _expressions.Add(expression); + + return expression; + } } + + public delegate object InterceptionDelegate(object instance); + public delegate bool TypeMatchDelegate(Type type); + public class TypeInterceptorExpression : IExpression, TypeInterceptor + { + private readonly TypeMatchDelegate _match; + private InterceptionDelegate _interception; + + internal TypeInterceptorExpression(TypeMatchDelegate match) + { + _match = match; + } + + void IExpression.Configure(PluginGraph graph) + { + graph.InterceptorLibrary.AddInterceptor(this); + } + + public void InterceptWith(InterceptionDelegate interception) + { + _interception = interception; + } + + public bool MatchesType(Type type) + { + return _match(type); + } + + public object Process(object target) + { + return _interception(target); + } + } + + internal delegate void PluginGraphAlteration(PluginGraph pluginGraph); + internal class BasicExpression : IExpression + { + private readonly PluginGraphAlteration _alteration; + + internal BasicExpression(PluginGraphAlteration alteration) + { + _alteration = alteration; + } + + public void Configure(PluginGraph graph) + { + _alteration(graph); + } + } } \ No newline at end of file Deleted: trunk/Source/StructureMap/Delegates.cs =================================================================== --- trunk/Source/StructureMap/Delegates.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/Delegates.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -1,52 +0,0 @@ -namespace StructureMap -{ - public delegate T EnrichmentHandler<T>(T target); - - public delegate void StartupHandler<T>(T target); - - public interface InstanceInterceptor - { - object Process(object target); - } - - public class NulloInterceptor : InstanceInterceptor - { - public object Process(object target) - { - return target; - } - } - - public class StartupInterceptor<T> : InstanceInterceptor - { - private readonly StartupHandler<T> _handler; - - public StartupInterceptor(StartupHandler<T> handler) - { - _handler = handler; - } - - - public object Process(object target) - { - _handler((T) target); - return target; - } - } - - public class EnrichmentInterceptor<T> : InstanceInterceptor - { - private readonly EnrichmentHandler<T> _handler; - - - public EnrichmentInterceptor(EnrichmentHandler<T> handler) - { - _handler = handler; - } - - public object Process(object target) - { - return _handler((T) target); - } - } -} \ No newline at end of file Modified: trunk/Source/StructureMap/Graph/PluginGraph.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginGraph.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/Graph/PluginGraph.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Reflection; using StructureMap.Configuration.DSL; +using StructureMap.Interceptors; namespace StructureMap.Graph { @@ -14,10 +15,11 @@ [Serializable] public class PluginGraph { - private AssemblyGraphCollection _assemblies; + private readonly AssemblyGraphCollection _assemblies; private bool _sealed = false; - private PluginFamilyCollection _pluginFamilies; - private InstanceDefaultManager _defaultManager = new InstanceDefaultManager(); + private readonly PluginFamilyCollection _pluginFamilies; + private readonly InstanceDefaultManager _defaultManager = new InstanceDefaultManager(); + private readonly InterceptorLibrary _interceptorLibrary = new InterceptorLibrary(); /// <summary> @@ -116,6 +118,11 @@ get { return _defaultManager; } } + public InterceptorLibrary InterceptorLibrary + { + get { return _interceptorLibrary; } + } + /// <summary> /// Un-seals a PluginGraph. Makes the PluginGraph editable /// </summary> Modified: trunk/Source/StructureMap/IInstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/IInstanceFactory.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/IInstanceFactory.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -11,8 +11,8 @@ /// <summary> /// Establishes a reference to the parent InstanceManager /// </summary> - /// <param name="Manager"></param> - void SetInstanceManager(InstanceManager Manager); + /// <param name="instanceManager"></param> + void SetInstanceManager(InstanceManager instanceManager); /// <summary> /// The CLR System.Type that the IInstanceManager builds instances Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -6,6 +6,7 @@ using StructureMap.Configuration.DSL; using StructureMap.Emitting; using StructureMap.Graph; +using StructureMap.Interceptors; using StructureMap.Source; namespace StructureMap @@ -19,6 +20,7 @@ private readonly Dictionary<string, InstanceBuilder> _instanceBuilders; private MementoSource _source; private readonly InstanceInterceptor _interceptor = new NulloInterceptor(); + private InterceptorLibrary _interceptorLibrary = InterceptorLibrary.Empty; #region static constructors @@ -123,18 +125,19 @@ /// <summary> /// Links the child InstanceBuilder members to the parent InstanceManager /// </summary> - /// <param name="Manager"></param> - public void SetInstanceManager(InstanceManager Manager) + /// <param name="instanceManager"></param> + public void SetInstanceManager(InstanceManager instanceManager) { + _interceptorLibrary = instanceManager.InterceptorLibrary; foreach (InstanceBuilder builder in _instanceBuilders.Values) { - builder.SetInstanceManager(Manager); + builder.SetInstanceManager(instanceManager); } } #region create instance builders - private void processPlugins(Plugin[] plugins) + private void processPlugins(IEnumerable<Plugin> plugins) { Assembly assembly = createInstanceBuilderAssembly(plugins); foreach (Plugin plugin in plugins) @@ -143,7 +146,7 @@ } } - private Assembly createInstanceBuilderAssembly(Plugin[] plugins) + private Assembly createInstanceBuilderAssembly(IEnumerable<Plugin> plugins) { string assemblyName = Guid.NewGuid().ToString().Replace(".", "") + "InstanceBuilderAssembly"; InstanceBuilderAssembly builderAssembly = new InstanceBuilderAssembly(assemblyName, PluginType); @@ -218,17 +221,15 @@ object IInstanceCreator.BuildInstance(InstanceMemento memento) { - if (!_instanceBuilders.ContainsKey(memento.ConcreteKey)) - { - throw new StructureMapException( - 201, memento.ConcreteKey, memento.InstanceKey, PluginType.FullName); - } + assertThatTheConcreteKeyExists(memento); - InstanceBuilder builder = _instanceBuilders[memento.ConcreteKey]; try { - return builder.BuildInstance(memento); + InstanceBuilder builder = _instanceBuilders[memento.ConcreteKey]; + object constructedInstance = builder.BuildInstance(memento); + CompoundInterceptor interceptor = _interceptorLibrary.FindInterceptor(constructedInstance.GetType()); + return interceptor.Process(constructedInstance); } catch (StructureMapException) { @@ -244,7 +245,16 @@ } } + private void assertThatTheConcreteKeyExists(InstanceMemento memento) + { + if (!_instanceBuilders.ContainsKey(memento.ConcreteKey)) + { + throw new StructureMapException( + 201, memento.ConcreteKey, memento.InstanceKey, PluginType.FullName); + } + } + /// <summary> /// Builds a new instance of the default instance of the PluginType /// </summary> Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -4,6 +4,7 @@ using StructureMap.Configuration.DSL; using StructureMap.Exceptions; using StructureMap.Graph; +using StructureMap.Interceptors; namespace StructureMap { @@ -12,10 +13,11 @@ /// </summary> public class InstanceManager : IInstanceManager, IEnumerable { - private Dictionary<Type, IInstanceFactory> _factories; - private bool _failOnException = true; - private GenericsPluginGraph _genericsGraph; - private InstanceDefaultManager _defaultManager; + private readonly Dictionary<Type, IInstanceFactory> _factories; + private readonly bool _failOnException = true; + private readonly GenericsPluginGraph _genericsGraph; + private readonly InstanceDefaultManager _defaultManager; + private readonly InterceptorLibrary _interceptorLibrary; /// <summary> /// Default constructor @@ -24,6 +26,7 @@ { _factories = new Dictionary<Type, IInstanceFactory>(); _genericsGraph = new GenericsPluginGraph(); + _interceptorLibrary = new InterceptorLibrary(); } /// <summary> @@ -46,6 +49,7 @@ { _failOnException = failOnException; _defaultManager = pluginGraph.DefaultManager; + _interceptorLibrary = pluginGraph.InterceptorLibrary; if (!pluginGraph.IsSealed) { @@ -70,6 +74,12 @@ get { return _defaultManager; } } + + public InterceptorLibrary InterceptorLibrary + { + get { return _interceptorLibrary; } + } + private IInstanceFactory registerPluginFamily(PluginFamily family) { InstanceFactory factory = new InstanceFactory(family, _failOnException); Modified: trunk/Source/StructureMap/InstanceMemento.cs =================================================================== --- trunk/Source/StructureMap/InstanceMemento.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/InstanceMemento.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -2,6 +2,7 @@ using StructureMap.Configuration; using StructureMap.Configuration.Tokens; using StructureMap.Graph; +using StructureMap.Interceptors; namespace StructureMap { Added: trunk/Source/StructureMap/Interceptors/CompoundInterceptor.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/CompoundInterceptor.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/CompoundInterceptor.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureMap.Interceptors +{ + public class CompoundInterceptor : InstanceInterceptor + { + private readonly InstanceInterceptor[] _interceptors; + + public CompoundInterceptor(InstanceInterceptor[] interceptors) + { + _interceptors = interceptors; + } + + public object Process(object target) + { + object returnValue = target; + foreach (InstanceInterceptor interceptor in _interceptors) + { + returnValue = interceptor.Process(returnValue); + } + + return returnValue; + } + + + public InstanceInterceptor[] Interceptors + { + get { return _interceptors; } + } + } +} Added: trunk/Source/StructureMap/Interceptors/EnrichmentInterceptor.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/EnrichmentInterceptor.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/EnrichmentInterceptor.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,18 @@ +namespace StructureMap.Interceptors +{ + public class EnrichmentInterceptor<T> : InstanceInterceptor + { + private readonly EnrichmentHandler<T> _handler; + + + public EnrichmentInterceptor(EnrichmentHandler<T> handler) + { + _handler = handler; + } + + public object Process(object target) + { + return _handler((T)target); + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Interceptors/InstanceInterceptor.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/InstanceInterceptor.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/InstanceInterceptor.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,7 @@ +namespace StructureMap.Interceptors +{ + public interface InstanceInterceptor + { + object Process(object target); + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Interceptors/InterceptorLibrary.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/InterceptorLibrary.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/InterceptorLibrary.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; + +namespace StructureMap.Interceptors +{ + public class InterceptorLibrary + { + public static readonly InterceptorLibrary Empty = new InterceptorLibrary(); + + private readonly Dictionary<Type, CompoundInterceptor> _analyzedInterceptors + = new Dictionary<Type, CompoundInterceptor>(); + + private readonly List<TypeInterceptor> _interceptors = new List<TypeInterceptor>(); + private readonly object _locker = new object(); + + public void AddInterceptor(TypeInterceptor interceptor) + { + _interceptors.Add(interceptor); + } + + public CompoundInterceptor FindInterceptor(Type type) + { + if (_analyzedInterceptors.ContainsKey(type)) + { + return _analyzedInterceptors[type]; + } + + lock (_locker) + { + if (!_analyzedInterceptors.ContainsKey(type)) + { + TypeInterceptor[] interceptorArray = + _interceptors.FindAll(delegate(TypeInterceptor i) { return i.MatchesType(type); }).ToArray(); + _analyzedInterceptors.Add(type, new CompoundInterceptor(interceptorArray)); + } + } + + return _analyzedInterceptors[type]; + } + + public InstanceInterceptor[] FindInterceptors(Type type) + { + return FindInterceptor(type).Interceptors; + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Interceptors/Interceptors.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/Interceptors.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/Interceptors.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,6 @@ +namespace StructureMap.Interceptors +{ + public delegate T EnrichmentHandler<T>(T target); + + public delegate void StartupHandler<T>(T target); +} Added: trunk/Source/StructureMap/Interceptors/NulloInterceptor.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/NulloInterceptor.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/NulloInterceptor.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,10 @@ +namespace StructureMap.Interceptors +{ + public class NulloInterceptor : InstanceInterceptor + { + public object Process(object target) + { + return target; + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Interceptors/StartupInterceptor.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/StartupInterceptor.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/StartupInterceptor.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,19 @@ +namespace StructureMap.Interceptors +{ + public class StartupInterceptor<T> : InstanceInterceptor + { + private readonly StartupHandler<T> _handler; + + public StartupInterceptor(StartupHandler<T> handler) + { + _handler = handler; + } + + + public object Process(object target) + { + _handler((T)target); + return target; + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap/Interceptors/TypeInterceptor.cs =================================================================== --- trunk/Source/StructureMap/Interceptors/TypeInterceptor.cs (rev 0) +++ trunk/Source/StructureMap/Interceptors/TypeInterceptor.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,9 @@ +using System; + +namespace StructureMap.Interceptors +{ + public interface TypeInterceptor : InstanceInterceptor + { + bool MatchesType(Type type); + } +} \ No newline at end of file Modified: trunk/Source/StructureMap/StructureMap.csproj =================================================================== --- trunk/Source/StructureMap/StructureMap.csproj 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap/StructureMap.csproj 2008-01-14 03:57:47 UTC (rev 53) @@ -335,7 +335,6 @@ <SubType>Code</SubType> </Compile> <Compile Include="ConstructorMemento.cs" /> - <Compile Include="Delegates.cs" /> <Compile Include="DeploymentTasks\DeploymentConfiguration.cs"> <SubType>Code</SubType> </Compile> @@ -471,6 +470,8 @@ <Compile Include="Interceptors\CacheInterceptor.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Interceptors\CompoundInterceptor.cs" /> + <Compile Include="Interceptors\EnrichmentInterceptor.cs" /> <Compile Include="Interceptors\HttpContextItemInterceptor.cs"> <SubType>Code</SubType> </Compile> @@ -483,15 +484,21 @@ <Compile Include="Interceptors\InstanceFactoryInterceptor.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Interceptors\InstanceInterceptor.cs" /> <Compile Include="Interceptors\InterceptorChainBuilder.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Interceptors\InterceptorLibrary.cs" /> + <Compile Include="Interceptors\Interceptors.cs" /> + <Compile Include="Interceptors\NulloInterceptor.cs" /> <Compile Include="Interceptors\SingletonInterceptor.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Interceptors\StartupInterceptor.cs" /> <Compile Include="Interceptors\ThreadLocalStorageInterceptor.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Interceptors\TypeInterceptor.cs" /> <Compile Include="IPluginGraphSource.cs" /> <Compile Include="MementoSource.cs"> <SubType>Code</SubType> Modified: trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap.Testing/Container/InstanceFactoryTester.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -1,5 +1,6 @@ using NUnit.Framework; using StructureMap.Graph; +using StructureMap.Interceptors; using StructureMap.Source; using StructureMap.Testing.Widget; using StructureMap.Testing.Widget2; Added: trunk/Source/StructureMap.Testing/Container/Interceptors/CompoundInterceptorTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/Interceptors/CompoundInterceptorTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Container/Interceptors/CompoundInterceptorTester.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,46 @@ +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Interceptors; + +namespace StructureMap.Testing.Container.Interceptors +{ + [TestFixture] + public class CompoundInterceptorTester + { + #region Setup/Teardown + + [SetUp] + public void SetUp() + { + } + + #endregion + + [Test] + public void CallAllTheInterceptors() + { + MockRepository mocks = new MockRepository(); + InstanceInterceptor interceptor1 = mocks.CreateMock<InstanceInterceptor>(); + InstanceInterceptor interceptor2 = mocks.CreateMock<InstanceInterceptor>(); + InstanceInterceptor interceptor3 = mocks.CreateMock<InstanceInterceptor>(); + InstanceInterceptor interceptor4 = mocks.CreateMock<InstanceInterceptor>(); + + Expect.Call(interceptor1.Process("0")).Return("1"); + Expect.Call(interceptor2.Process("1")).Return("2"); + Expect.Call(interceptor3.Process("2")).Return("3"); + Expect.Call(interceptor4.Process("3")).Return("4"); + + mocks.ReplayAll(); + CompoundInterceptor compoundInterceptor = new CompoundInterceptor(new InstanceInterceptor[] + { + interceptor1, + interceptor2, + interceptor3, + interceptor4 + }); + + Assert.AreEqual("4", compoundInterceptor.Process("0")); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap.Testing/Container/Interceptors/InterceptorLibraryTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/Interceptors/InterceptorLibraryTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Container/Interceptors/InterceptorLibraryTester.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,122 @@ +using System; +using NUnit.Framework; +using Rhino.Mocks; +using StructureMap.Interceptors; + +namespace StructureMap.Testing.Container.Interceptors +{ + [TestFixture] + public class InterceptorLibraryTester + { + private MockTypeInterceptor _interceptor1; + private MockTypeInterceptor _interceptor2; + private MockTypeInterceptor _interceptor3; + private MockTypeInterceptor _interceptor4; + private InterceptorLibrary _library; + + [SetUp] + public void SetUp() + { + _interceptor1 = new MockTypeInterceptor(typeof(string)); + _interceptor2 = new MockTypeInterceptor(typeof(int), typeof(double)); + _interceptor3 = new MockTypeInterceptor(typeof(string), typeof(bool)); + _interceptor4 = new MockTypeInterceptor(typeof(string), typeof(double)); + + _library = new InterceptorLibrary(); + _library.AddInterceptor(_interceptor1); + _library.AddInterceptor(_interceptor2); + _library.AddInterceptor(_interceptor3); + _library.AddInterceptor(_interceptor4); + } + + [Test] + public void Find_All_Of_The_Interceptors_For_A_Type_On_The_First_Pass() + { + Assert.AreEqual(new TypeInterceptor[]{_interceptor1, _interceptor3, _interceptor4}, _library.FindInterceptors(typeof(string))); + Assert.AreEqual(new TypeInterceptor[]{_interceptor2, _interceptor4}, _library.FindInterceptors(typeof(double))); + Assert.AreEqual(new TypeInterceptor[]{_interceptor2}, _library.FindInterceptors(typeof(int))); + Assert.AreEqual(new TypeInterceptor[]{_interceptor3}, _library.FindInterceptors(typeof(bool))); + } + + [Test] + public void Find_CompoundInterceptor_For_A_Type_On_The_First_Pass() + { + Assert.AreEqual(new TypeInterceptor[] { _interceptor1, _interceptor3, _interceptor4 }, _library.FindInterceptor(typeof(string)).Interceptors); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2, _interceptor4 }, _library.FindInterceptor(typeof(double)).Interceptors); + } + + [Test] + public void Find_All_Of_The_Interceptors_For_A_Type_On_Multiple_Passes() + { + Assert.AreEqual(new TypeInterceptor[] { _interceptor1, _interceptor3, _interceptor4 }, _library.FindInterceptors(typeof(string))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2, _interceptor4 }, _library.FindInterceptors(typeof(double))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2 }, _library.FindInterceptors(typeof(int))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor3 }, _library.FindInterceptors(typeof(bool))); + + Assert.AreEqual(new TypeInterceptor[] { _interceptor1, _interceptor3, _interceptor4 }, _library.FindInterceptors(typeof(string))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2, _interceptor4 }, _library.FindInterceptors(typeof(double))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2 }, _library.FindInterceptors(typeof(int))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor3 }, _library.FindInterceptors(typeof(bool))); + + Assert.AreEqual(new TypeInterceptor[] { _interceptor1, _interceptor3, _interceptor4 }, _library.FindInterceptors(typeof(string))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2, _interceptor4 }, _library.FindInterceptors(typeof(double))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2 }, _library.FindInterceptors(typeof(int))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor3 }, _library.FindInterceptors(typeof(bool))); + + Assert.AreEqual(new TypeInterceptor[] { _interceptor1, _interceptor3, _interceptor4 }, _library.FindInterceptors(typeof(string))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2, _interceptor4 }, _library.FindInterceptors(typeof(double))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor2 }, _library.FindInterceptors(typeof(int))); + Assert.AreEqual(new TypeInterceptor[] { _interceptor3 }, _library.FindInterceptors(typeof(bool))); + } + + + + [Test] + public void When_Interceptors_Are_Requested_For_A_Type_For_The_First_Time_The_Library_Will_Scan_All_The_TypeInterceptors() + { + MockRepository mocks = new MockRepository(); + TypeInterceptor interceptor1 = mocks.CreateMock<TypeInterceptor>(); + TypeInterceptor interceptor2 = mocks.CreateMock<TypeInterceptor>(); + TypeInterceptor interceptor3 = mocks.CreateMock<TypeInterceptor>(); + + _library.AddInterceptor(interceptor1); + _library.AddInterceptor(interceptor2); + _library.AddInterceptor(interceptor3); + + Type type = typeof (string); + Expect.Call(interceptor1.MatchesType(type)).Return(true); + Expect.Call(interceptor2.MatchesType(type)).Return(true); + Expect.Call(interceptor3.MatchesType(type)).Return(true); + + mocks.ReplayAll(); + _library.FindInterceptors(type); + mocks.VerifyAll(); + } + + [Test] + public void When_Interceptors_Are_Requested_For_The_Second_Time_The_Library_Will_NOT_Scan_The_Interceptors_Again() + { + MockRepository mocks = new MockRepository(); + TypeInterceptor interceptor1 = mocks.CreateMock<TypeInterceptor>(); + TypeInterceptor interceptor2 = mocks.CreateMock<TypeInterceptor>(); + TypeInterceptor interceptor3 = mocks.CreateMock<TypeInterceptor>(); + + _library.AddInterceptor(interceptor1); + _library.AddInterceptor(interceptor2); + _library.AddInterceptor(interceptor3); + + Type type = typeof(string); + Expect.Call(interceptor1.MatchesType(type)).Return(true); + Expect.Call(interceptor2.MatchesType(type)).Return(true); + Expect.Call(interceptor3.MatchesType(type)).Return(true); + + mocks.ReplayAll(); + _library.FindInterceptors(type); + _library.FindInterceptors(type); + _library.FindInterceptors(type); + _library.FindInterceptors(type); + _library.FindInterceptors(type); + mocks.VerifyAll(); + } + } +} Added: trunk/Source/StructureMap.Testing/Container/Interceptors/MockTypeInterceptor.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/Interceptors/MockTypeInterceptor.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Container/Interceptors/MockTypeInterceptor.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using StructureMap.Interceptors; + +namespace StructureMap.Testing.Container.Interceptors +{ + + + public class MockTypeInterceptor : TypeInterceptor + { + private readonly List<Type> _types = new List<Type>(); + private Dictionary<Type, InstanceInterceptor> _innerInterceptors = new Dictionary<Type, InstanceInterceptor>(); + + public MockTypeInterceptor(params Type[] types) + { + _types.AddRange(types); + } + + public void SetToMatch<T>() + { + _types.Add(typeof(T)); + } + + public bool MatchesType(Type type) + { + return _types.Contains(type); + } + + public object Process(object target) + { + return _innerInterceptors[target.GetType()].Process(target); + } + + public void AddHandler<T>(InterceptionDelegate<T> handler) + { + _types.Add(typeof(T)); + _innerInterceptors.Add(typeof(T), new CommonInterceptor<T>(handler)); + } + + public delegate object InterceptionDelegate<T>(T target); + public class CommonInterceptor<T> : InstanceInterceptor + { + private readonly InterceptionDelegate<T> _handler; + + public CommonInterceptor(InterceptionDelegate<T> handler) + { + _handler = handler; + } + + public object Process(object target) + { + return _handler((T) target); + } + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap.Testing/Container/Interceptors/TypeInterceptionTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/Interceptors/TypeInterceptionTester.cs (rev 0) +++ trunk/Source/StructureMap.Testing/Container/Interceptors/TypeInterceptionTester.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -0,0 +1,108 @@ +using System; +using NUnit.Framework; +using StructureMap.Configuration.DSL; + +namespace StructureMap.Testing.Container.Interceptors +{ + [TestFixture] + public class TypeInterceptionTester : Registry + { + private Registry registry; + private IInstanceManager manager; + + [SetUp] + public void SetUp() + { + manager = null; + + // TODO: Want a shorthand for Type + registry = new Registry(); + registry.ForRequestedType<IAnInterfaceOfSomeSort>() + .AddInstance(Instance<IAnInterfaceOfSomeSort>().UsingConcreteType<RedSomething>().WithName("Red")) + .AddInstance(Instance<IAnInterfaceOfSomeSort>().UsingConcreteType<GreenSomething>().WithName("Green")) + .AddInstance(Instance<IAnInterfaceOfSomeSort>().UsingConcreteType<BlueSomething>().WithName("Blue")); + + } + + [Test] + public void If_An_Interceptor_Is_Registered_At_The_PluginGraph_It_Will_Be_Used_To_Construct_An_Instance() + { + MockTypeInterceptor interceptor = new MockTypeInterceptor(); + interceptor.AddHandler<RedSomething>( + delegate(RedSomething something) { return new WrappedSomething(something); }); + + interceptor.AddHandler<GreenSomething>( + delegate(GreenSomething something) { return new WrappedSomething2(something); }); + + registry.RegisterInterceptor(interceptor); + + assertThisIsType<BlueSomething>("Blue"); + assertThatThisIsWrappedSomething<WrappedSomething, RedSomething>("Red"); + assertThatThisIsWrappedSomething<WrappedSomething2, GreenSomething>("Green"); + } + + [Test] + public void Register_A_Type_Interceptor_By_The_Fluent_Interface() + { + registry.IfTypeMatches(delegate(Type type) { return type.Equals(typeof(BlueSomething)); }) + .InterceptWith(delegate(object rawInstance) + { + return new WrappedSomething((IAnInterfaceOfSomeSort)rawInstance); + }); + + assertThisIsType<RedSomething>("Red"); + assertThisIsType<GreenSomething>("Green"); + assertThatThisIsWrappedSomething<WrappedSomething, BlueSomething>("Blue"); + } + + private void assertThisIsType<T>(string name) + { + if (manager == null) + { + manager = registry.BuildInstanceManager(); + } + + Assert.IsInstanceOfType(typeof(T), manager.CreateInstance<IAnInterfaceOfSomeSort>(name)); + } + + private void assertThatThisIsWrappedSomething<OUTERTYPE, INNERTYPE>(string name) where OUTERTYPE : WrappedSomething + { + if (manager == null) + { + manager = registry.BuildInstanceManager(); + } + + OUTERTYPE something = (OUTERTYPE) manager.CreateInstance<IAnInterfaceOfSomeSort>(name); + Assert.IsInstanceOfType(typeof(INNERTYPE), something.Inner); + } + + public interface IAnInterfaceOfSomeSort{} + + public class RedSomething : IAnInterfaceOfSomeSort {} + public class GreenSomething : IAnInterfaceOfSomeSort {} + public class BlueSomething : IAnInterfaceOfSomeSort {} + + public class WrappedSomething : IAnInterfaceOfSomeSort + { + private readonly IAnInterfaceOfSomeSort _inner; + + public WrappedSomething(IAnInterfaceOfSomeSort inner) + { + _inner = inner; + } + + + public IAnInterfaceOfSomeSort Inner + { + get { return _inner; } + } + } + + public class WrappedSomething2 : WrappedSomething + { + public WrappedSomething2(IAnInterfaceOfSomeSort inner) : base(inner) + { + } + } + } +} Modified: trunk/Source/StructureMap.Testing/InstanceMementoTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/InstanceMementoTester.cs 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap.Testing/InstanceMementoTester.cs 2008-01-14 03:57:47 UTC (rev 53) @@ -1,5 +1,6 @@ using NUnit.Framework; using Rhino.Mocks; +using StructureMap.Interceptors; using StructureMap.Testing.Widget3; namespace StructureMap.Testing Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj =================================================================== --- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-01-12 03:21:32 UTC (rev 52) +++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2008-01-14 03:57:47 UTC (rev 53) @@ -313,15 +313,19 @@ <Compile Include="Container\IntegratedTester.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Container\Interceptors\CompoundInterceptorTester.cs" /> <Compile Include="Container\Interceptors\InteceptorChainBuilderTester.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Container\Interceptors\InterceptorLibraryTester.cs" /> + <Compile Include="Container\Interceptors\MockTypeInterceptor.cs" /> <Compile Include="Container\Interceptors\SingletonInterceptorTester.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Container\Interceptors\ThreadLocalStorageInterceptorTester.cs"> <SubType>Code</SubType> </Compile> + <Compile Include="Container\Interceptors\TypeInterceptionTester.cs" /> <Compile Include="Container\MockingTester.cs"> <SubType>Code</SubType> </Compile> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jer...@us...> - 2008-01-12 03:21:34
|
Revision: 52 http://structuremap.svn.sourceforge.net/structuremap/?rev=52&view=rev Author: jeremydmiller Date: 2008-01-11 19:21:32 -0800 (Fri, 11 Jan 2008) Log Message: ----------- the automocking start Modified Paths: -------------- trunk/Source/CommonAssemblyInfo.cs trunk/Source/StructureMap/InstanceFactory.cs trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj trunk/cruise.build Added Paths: ----------- trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs Modified: trunk/Source/CommonAssemblyInfo.cs =================================================================== --- trunk/Source/CommonAssemblyInfo.cs 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/Source/CommonAssemblyInfo.cs 2008-01-12 03:21:32 UTC (rev 52) @@ -13,10 +13,10 @@ //------------------------------------------------------------------------------ [assembly: ComVisibleAttribute(false)] -[assembly: AssemblyVersionAttribute("1.0.0.0000")] +[assembly: AssemblyVersionAttribute("2.5.0.0000")] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2007, Jeremy D. Miller")] [assembly: AssemblyProductAttribute("StructureMap")] [assembly: AssemblyCompanyAttribute("")] [assembly: AssemblyConfigurationAttribute("release")] -[assembly: AssemblyInformationalVersionAttribute("1.0.0.0000")] +[assembly: AssemblyInformationalVersionAttribute("2.5.0.0000")] Modified: trunk/Source/StructureMap/InstanceFactory.cs =================================================================== --- trunk/Source/StructureMap/InstanceFactory.cs 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/Source/StructureMap/InstanceFactory.cs 2008-01-12 03:21:32 UTC (rev 52) @@ -15,10 +15,10 @@ /// </summary> public class InstanceFactory : IInstanceFactory, IInstanceCreator { - private Type _pluginType; - private Dictionary<string, InstanceBuilder> _instanceBuilders; + private readonly Type _pluginType; + private readonly Dictionary<string, InstanceBuilder> _instanceBuilders; private MementoSource _source; - private InstanceInterceptor _interceptor = new NulloInterceptor(); + private readonly InstanceInterceptor _interceptor = new NulloInterceptor(); #region static constructors Added: trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs =================================================================== --- trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs (rev 0) +++ trunk/Source/StructureMap.AutoMocking/IntegrationSpecification.cs 2008-01-12 03:21:32 UTC (rev 52) @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace StructureMap.AutoMocking +{ + public class IntegrationSpecification<TARGETCLASS> + { + } +} Modified: trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj =================================================================== --- trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/Source/StructureMap.AutoMocking/StructureMap.AutoMocking.csproj 2008-01-12 03:21:32 UTC (rev 52) @@ -41,6 +41,7 @@ <Link>CommonAssemblyInfo.cs</Link> </Compile> <Compile Include="AutoMockedInstanceManager.cs" /> + <Compile Include="IntegrationSpecification.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="RhinoAutoMocker.cs" /> <Compile Include="RhinoMocksServiceLocator.cs" /> Modified: trunk/cruise.build =================================================================== --- trunk/cruise.build 2007-12-30 16:31:10 UTC (rev 51) +++ trunk/cruise.build 2008-01-12 03:21:32 UTC (rev 52) @@ -3,7 +3,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="1.0.0" /> + <property name="project.version" value="2.5.0" /> <property name="project.config" value="release" /> <property name="archive.dir" value="d:\builds\StructureMap"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |