|
From: <jer...@us...> - 2007-02-25 19:29:52
|
Revision: 24
http://structuremap.svn.sourceforge.net/structuremap/?rev=24&view=rev
Author: jeremydmiller
Date: 2007-02-25 11:29:51 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
Working on the Fluent Interface configuration for adding instances
Modified Paths:
--------------
trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs
trunk/Source/StructureMap/Configuration/DSL/DefaultExpression.cs
trunk/Source/StructureMap/Configuration/DSL/IExpression.cs
trunk/Source/StructureMap/Configuration/DSL/Registry.cs
trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs
trunk/Source/StructureMap/Graph/Plugin.cs
trunk/Source/StructureMap/Graph/PluginCollection.cs
trunk/Source/StructureMap/Graph/PluginGraph.cs
trunk/Source/StructureMap/InstanceFactory.cs
trunk/Source/StructureMap/InstanceManager.cs
trunk/Source/StructureMap/InstanceMemento.cs
trunk/Source/StructureMap/MemoryInstanceMemento.cs
trunk/Source/StructureMap/StructureMap.csproj
trunk/Source/StructureMap/StructureMapException.resx
trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs
trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs
trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs
trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.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/StructureMap.Testing.csproj
trunk/Source/StructureMap.Testing.Widget/IWidget.cs
trunk/Source/StructureMap.Testing.Widget/Rule.cs
Added Paths:
-----------
trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs
trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.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/IInstanceCreator.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/CreateProfileTester.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs
trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config
Added: trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs (rev 0)
+++ trunk/Source/StructureMap/Configuration/DSL/ChildInstanceExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using StructureMap.Graph;
+
+namespace StructureMap.Configuration.DSL
+{
+ public class ChildInstanceExpression : IExpression
+ {
+ private readonly InstanceExpression _instance;
+ private readonly MemoryInstanceMemento _memento;
+ private readonly string _propertyName;
+ private Plugin _plugin;
+ private Type _childType;
+ private List<IExpression> _children = new List<IExpression>();
+
+
+ public ChildInstanceExpression(InstanceExpression instance, MemoryInstanceMemento memento, string propertyName)
+ {
+ _instance = instance;
+ _memento = memento;
+ _propertyName = propertyName;
+ }
+
+
+
+ public InstanceExpression IsNamedInstance(string instanceKey)
+ {
+ MemoryInstanceMemento child = MemoryInstanceMemento.CreateReferencedInstanceMemento(instanceKey);
+ _memento.AddChild(_propertyName, child);
+
+ return _instance;
+ }
+
+ // TODO -- negative case if the concrete type cannot be an implicit instance
+ public InstanceExpression IsConcreteType<T>()
+ {
+ _plugin = Plugin.CreateImplicitPlugin(typeof(T));
+ MemoryInstanceMemento child = MemoryInstanceMemento.CreateReferencedInstanceMemento(_plugin.ConcreteKey);
+ _memento.AddChild(_propertyName, child);
+
+ return _instance;
+ }
+
+
+ void IExpression.Configure(PluginGraph graph)
+ {
+ if (_plugin == null || _childType == null)
+ {
+ return;
+ }
+
+ PluginFamily family = graph.LocateOrCreateFamilyForType(_childType);
+ family.Plugins.FindOrCreate(_plugin.PluggedType);
+ }
+
+
+ IExpression[] IExpression.ChildExpressions
+ {
+ get { return _children.ToArray(); }
+ }
+
+ internal Type ChildType
+ {
+ set { _childType = value; }
+ }
+
+ public InstanceExpression Is(InstanceExpression child)
+ {
+ _children.Add(child);
+ MemoryInstanceMemento childMemento = MemoryInstanceMemento.CreateReferencedInstanceMemento(child.InstanceKey);
+ _memento.AddChild(_propertyName, childMemento);
+
+ return _instance;
+ }
+ }
+}
Modified: trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Configuration/DSL/CreatePluginFamilyExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -39,6 +39,11 @@
graph.Assemblies.Add(assembly);
}
+ IExpression[] IExpression.ChildExpressions
+ {
+ get { return new IExpression[0]; }
+ }
+
public CreatePluginFamilyExpression WithDefaultConcreteType<T>()
{
Plugin plugin = addPlugin<T>();
@@ -87,5 +92,10 @@
_scope = scope;
return this;
}
+
+ public void AndTheDefaultIs(InstanceExpression expression)
+ {
+ throw new NotImplementedException();
+ }
}
}
Modified: trunk/Source/StructureMap/Configuration/DSL/DefaultExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/DefaultExpression.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Configuration/DSL/DefaultExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -17,5 +17,10 @@
{
_configure(graph);
}
+
+ IExpression[] IExpression.ChildExpressions
+ {
+ get { return new IExpression[0]; }
+ }
}
}
Modified: trunk/Source/StructureMap/Configuration/DSL/IExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/IExpression.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Configuration/DSL/IExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -8,5 +8,6 @@
public interface IExpression
{
void Configure(PluginGraph graph);
+ IExpression[] ChildExpressions { get;}
}
}
Added: trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs (rev 0)
+++ trunk/Source/StructureMap/Configuration/DSL/InstanceExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Reflection;
+using StructureMap.Graph;
+
+namespace StructureMap.Configuration.DSL
+{
+ public class InstanceExpression : IExpression
+ {
+ private readonly Type _pluginType;
+ private Type _pluggedType;
+ private string _propertyName;
+ private MemoryInstanceMemento _memento;
+ private List<IExpression> _children = new List<IExpression>();
+
+
+
+ public InstanceExpression(Type pluginType)
+ {
+ _pluginType = pluginType;
+ _memento = new MemoryInstanceMemento();
+ _memento.InstanceKey = Guid.NewGuid().ToString();
+ }
+
+ void IExpression.Configure(PluginGraph graph)
+ {
+ if (_pluggedType == null && string.IsNullOrEmpty(_memento.ConcreteKey))
+ {
+ throw new StructureMapException(301, _memento.InstanceKey, TypePath.GetAssemblyQualifiedName(_pluginType));
+ }
+
+ PluginFamily family = graph.LocateOrCreateFamilyForType(_pluginType);
+ Plugin plugin = _pluggedType == null
+ ? family.Plugins[_memento.ConcreteKey]
+ : family.Plugins.FindOrCreate(_pluggedType);
+
+ _memento.ConcreteKey = plugin.ConcreteKey;
+
+
+
+ family.Source.AddExternalMemento(_memento);
+ }
+
+
+ public IExpression[] ChildExpressions
+ {
+ get { return _children.ToArray(); }
+ }
+
+
+ public InstanceExpression WithName(string instanceKey)
+ {
+ _memento.InstanceKey = instanceKey;
+ return this;
+ }
+
+
+ public string InstanceKey
+ {
+ get { return _memento.InstanceKey; }
+ set { _memento.InstanceKey = value; }
+ }
+
+ internal Type PluginType
+ {
+ get { return _pluginType; }
+ }
+
+ public InstanceExpression UsingConcreteType<T>()
+ {
+ _pluggedType = typeof (T);
+ return this;
+ }
+
+ public PropertyExpression WithProperty(string propertyName)
+ {
+ return new PropertyExpression(this, _memento, propertyName);
+ }
+
+
+
+
+ public void UsePrototype(ICloneable cloneable)
+ {
+
+ }
+
+
+
+ public InstanceExpression UsingConcreteTypeNamed(string concreteKey)
+ {
+ _memento.ConcreteKey = concreteKey;
+ return this;
+ }
+
+ public ChildInstanceExpression Child(string propertyName)
+ {
+ ChildInstanceExpression child = new ChildInstanceExpression(this,_memento, propertyName);
+ _children.Add(child);
+
+ return child;
+ }
+
+ public ChildInstanceExpression Child<T>()
+ {
+ // TODO -- what if the property can't be found
+ string propertyName = findPropertyName<T>();
+ ChildInstanceExpression child = Child(propertyName);
+ child.ChildType = typeof (T);
+ return child;
+ }
+
+ private string findPropertyName<T>()
+ {
+ Plugin plugin = Plugin.CreateImplicitPlugin(_pluggedType);
+ return plugin.FindFirstConstructorArgumentOfType<T>();
+ }
+
+
+
+ }
+}
Added: trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs (rev 0)
+++ trunk/Source/StructureMap/Configuration/DSL/ProfileExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,18 @@
+using System;
+using StructureMap.Graph;
+
+namespace StructureMap.Configuration.DSL
+{
+ public class ProfileExpression : IExpression
+ {
+ public void Configure(PluginGraph graph)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IExpression[] ChildExpressions
+ {
+ get { throw new NotImplementedException(); }
+ }
+ }
+}
Added: trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs (rev 0)
+++ trunk/Source/StructureMap/Configuration/DSL/PropertyExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Text;
+
+namespace StructureMap.Configuration.DSL
+{
+ 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;
+ }
+
+ public InstanceExpression EqualTo(object propertyValue)
+ {
+ _memento.SetProperty(_propertyName, propertyValue.ToString());
+ return _instance;
+ }
+
+ public InstanceExpression EqualToAppSetting(string appSettingKey)
+ {
+ string propertyValue = ConfigurationManager.AppSettings[appSettingKey];
+ _memento.SetProperty(_propertyName, propertyValue);
+ return _instance;
+ }
+ }
+}
Added: trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs (rev 0)
+++ trunk/Source/StructureMap/Configuration/DSL/PrototypeExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using StructureMap.Graph;
+
+namespace StructureMap.Configuration.DSL
+{
+ public class PrototypeExpression : IExpression
+ {
+ public void Configure(PluginGraph graph)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IExpression[] ChildExpressions
+ {
+ get { return new IExpression[0]; }
+ }
+
+ public void WithName(string instanceKey)
+ {
+
+ }
+ }
+}
Modified: trunk/Source/StructureMap/Configuration/DSL/Registry.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Configuration/DSL/Registry.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -7,7 +7,7 @@
public class Registry : IDisposable
{
private List<IExpression> _expressions = new List<IExpression>();
- private readonly PluginGraph _graph;
+ private PluginGraph _graph;
public Registry(PluginGraph graph)
{
@@ -16,7 +16,17 @@
public Registry()
{
+ _graph = new PluginGraph();
+ }
+
+
+ /// <summary>
+ /// Implement this method to
+ /// </summary>
+ protected virtual void configure()
+ {
+ // no-op;
}
protected void addExpression(IExpression expression)
@@ -24,17 +34,26 @@
_expressions.Add(expression);
}
- public void Configure(PluginGraph graph)
+ private void configurePluginGraph(PluginGraph graph)
{
foreach (IExpression expression in _expressions)
{
- expression.Configure(graph);
+ configureExpression(expression, graph);
}
}
+ private static void configureExpression(IExpression expression, PluginGraph graph)
+ {
+ expression.Configure(graph);
+ foreach (IExpression childExpression in expression.ChildExpressions)
+ {
+ configureExpression(childExpression, graph);
+ }
+ }
+
public void Dispose()
{
- Configure(_graph);
+ configurePluginGraph(_graph);
}
public ScanAssembliesExpression ScanAssemblies()
@@ -56,8 +75,25 @@
public InstanceManager BuildInstanceManager()
{
PluginGraph graph = new PluginGraph();
- Configure(graph);
+ configurePluginGraph(graph);
return new InstanceManager(graph);
}
+
+ public InstanceExpression AddInstanceOf<T>()
+ {
+ InstanceExpression expression = new InstanceExpression(typeof(T));
+ addExpression(expression);
+ return expression;
+ }
+
+ public static InstanceExpression Instance<T>()
+ {
+ return new InstanceExpression(typeof(T));
+ }
+
+ public PrototypeExpression AddInstanceOf<T>(T prototype)
+ {
+ return new PrototypeExpression();
+ }
}
}
Modified: trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Configuration/DSL/ScanAssembliesExpression.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -20,6 +20,11 @@
}
}
+ public IExpression[] ChildExpressions
+ {
+ get { return new IExpression[0]; }
+ }
+
public ScanAssembliesExpression IncludeTheCallingAssembly()
{
Assembly callingAssembly = findTheCallingAssembly();
Modified: trunk/Source/StructureMap/Graph/Plugin.cs
===================================================================
--- trunk/Source/StructureMap/Graph/Plugin.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Graph/Plugin.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -398,5 +398,19 @@
{
return (_pluggedType != null ? _pluggedType.GetHashCode() : 0) + 29*(_concreteKey != null ? _concreteKey.GetHashCode() : 0);
}
+
+ public string FindFirstConstructorArgumentOfType<T>()
+ {
+ ConstructorInfo ctor = this.GetConstructor();
+ foreach (ParameterInfo info in ctor.GetParameters())
+ {
+ if (info.ParameterType.Equals(typeof(T)))
+ {
+ return info.Name;
+ }
+ }
+
+ throw new StructureMapException(302, typeof (T).FullName, _pluggedType.FullName);
+ }
}
}
\ No newline at end of file
Modified: trunk/Source/StructureMap/Graph/PluginCollection.cs
===================================================================
--- trunk/Source/StructureMap/Graph/PluginCollection.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Graph/PluginCollection.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -153,5 +153,13 @@
}
}
}
+
+ public Plugin FindOrCreate(Type pluggedType)
+ {
+ Plugin plugin = Plugin.CreateImplicitPlugin(pluggedType);
+ Add(plugin);
+
+ return plugin;
+ }
}
}
\ No newline at end of file
Modified: trunk/Source/StructureMap/Graph/PluginGraph.cs
===================================================================
--- trunk/Source/StructureMap/Graph/PluginGraph.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/Graph/PluginGraph.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -143,13 +143,24 @@
public TypePath LocateOrCreateFamilyForType(string fullName)
{
Type pluginType = findTypeByFullName(fullName);
+ buildFamilyIfMissing(pluginType);
+
+ return new TypePath(pluginType);
+ }
+
+ private void buildFamilyIfMissing(Type pluginType)
+ {
if (!_pluginFamilies.Contains(pluginType))
{
PluginFamily family = _pluginFamilies.Add(pluginType, string.Empty);
attachImplicitPlugins(family);
}
+ }
- return new TypePath(pluginType);
+ public PluginFamily LocateOrCreateFamilyForType(Type pluginType)
+ {
+ buildFamilyIfMissing(pluginType);
+ return this.PluginFamilies[pluginType];
}
private Type findTypeByFullName(string fullName)
@@ -170,5 +181,7 @@
{
_defaultManager.ReadDefaultsFromPluginGraph(this);
}
+
+
}
}
\ No newline at end of file
Added: trunk/Source/StructureMap/IInstanceCreator.cs
===================================================================
--- trunk/Source/StructureMap/IInstanceCreator.cs (rev 0)
+++ trunk/Source/StructureMap/IInstanceCreator.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,7 @@
+namespace StructureMap
+{
+ public interface IInstanceCreator
+ {
+ object BuildInstance(InstanceMemento memento);
+ }
+}
Modified: trunk/Source/StructureMap/InstanceFactory.cs
===================================================================
--- trunk/Source/StructureMap/InstanceFactory.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/InstanceFactory.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -12,7 +12,7 @@
/// <summary>
/// Default implementation of IInstanceFactory
/// </summary>
- public class InstanceFactory : IInstanceFactory
+ public class InstanceFactory : IInstanceFactory, IInstanceCreator
{
private Type _pluginType;
private string _assemblyName;
@@ -204,11 +204,13 @@
{
// Let the MementoSource fill in Templates, resolve references, etc.
InstanceMemento resolvedMemento = _source.ResolveMemento(memento);
- return buildFromInstanceBuilder(resolvedMemento);
+
+
+ return resolvedMemento.Build(this);
}
- private object buildFromInstanceBuilder(InstanceMemento memento)
+ public object BuildInstance(InstanceMemento memento)
{
if (!_instanceBuilders.Contains(memento.ConcreteKey))
{
Modified: trunk/Source/StructureMap/InstanceManager.cs
===================================================================
--- trunk/Source/StructureMap/InstanceManager.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/InstanceManager.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -156,16 +156,9 @@
return instanceFactory.GetInstance(instanceKey);
}
- /// <summary>
- /// Creates the named instance of the PluginTypeName
- /// </summary>
- /// <param name="pluginTypeName">Fully qualified name of the CLR Type to create</param>
- /// <param name="instanceKey"></param>
- /// <returns></returns>
- public object CreateInstance(string pluginTypeName, string instanceKey)
+ public T CreateInstance<T>(string instanceKey)
{
- IInstanceFactory instanceFactory = this[pluginTypeName];
- return instanceFactory.GetInstance(instanceKey);
+ return (T) CreateInstance(typeof (T), instanceKey);
}
/// <summary>
@@ -179,6 +172,11 @@
return instanceFactory.GetInstance();
}
+ public T CreateInstance<T>()
+ {
+ return (T)CreateInstance(typeof(T));
+ }
+
/// <summary>
/// Creates a new object instance of the requested type
/// </summary>
@@ -203,6 +201,8 @@
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
@@ -331,6 +331,11 @@
return factory.GetInstance();
}
+ public T FillDependencies<T>()
+ {
+ return (T) FillDependencies(typeof (T));
+ }
+
private InstanceFactory getFilledTypeFactory(Type type)
{
if (!_filledTypeFactories.Contains(type))
Modified: trunk/Source/StructureMap/InstanceMemento.cs
===================================================================
--- trunk/Source/StructureMap/InstanceMemento.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/InstanceMemento.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -41,6 +41,7 @@
return _concreteKey;
}
+ set { _concreteKey = value; }
}
protected abstract string innerConcreteKey { get; }
@@ -260,5 +261,10 @@
return Plugin.CreateImplicitPlugin(pluggedType);
}
}
+
+ public virtual object Build(IInstanceCreator creator)
+ {
+ return creator.BuildInstance(this);
+ }
}
}
\ No newline at end of file
Modified: trunk/Source/StructureMap/MemoryInstanceMemento.cs
===================================================================
--- trunk/Source/StructureMap/MemoryInstanceMemento.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/MemoryInstanceMemento.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -75,7 +75,7 @@
}
- private MemoryInstanceMemento()
+ public MemoryInstanceMemento()
{
}
@@ -114,7 +114,13 @@
_children.Add(name, Memento);
}
+ public void ReferenceChild(string name, string instanceKey)
+ {
+ InstanceMemento child = MemoryInstanceMemento.CreateReferencedInstanceMemento(instanceKey);
+ AddChild(name, child);
+ }
+
/// <summary>
/// Links an array of InstanceMemento's to a named array property
/// </summary>
Modified: trunk/Source/StructureMap/StructureMap.csproj
===================================================================
--- trunk/Source/StructureMap/StructureMap.csproj 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/StructureMap.csproj 2007-02-25 19:29:51 UTC (rev 24)
@@ -103,6 +103,7 @@
<Reference Include="System">
<Name>System</Name>
</Reference>
+ <Reference Include="System.configuration" />
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
@@ -212,9 +213,14 @@
<Compile Include="Configuration\DiagnosticGraphBuilder.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Configuration\DSL\ChildInstanceExpression.cs" />
<Compile Include="Configuration\DSL\CreatePluginFamilyExpression.cs" />
<Compile Include="Configuration\DSL\DefaultExpression.cs" />
<Compile Include="Configuration\DSL\IExpression.cs" />
+ <Compile Include="Configuration\DSL\InstanceExpression.cs" />
+ <Compile Include="Configuration\DSL\ProfileExpression.cs" />
+ <Compile Include="Configuration\DSL\PropertyExpression.cs" />
+ <Compile Include="Configuration\DSL\PrototypeExpression.cs" />
<Compile Include="Configuration\DSL\Registry.cs" />
<Compile Include="Configuration\DSL\ScanAssembliesExpression.cs" />
<Compile Include="Configuration\FamilyParser.cs">
@@ -435,6 +441,7 @@
<Compile Include="Graph\TypePath.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="IInstanceCreator.cs" />
<Compile Include="IInstanceFactory.cs">
<SubType>Code</SubType>
</Compile>
Modified: trunk/Source/StructureMap/StructureMapException.resx
===================================================================
--- trunk/Source/StructureMap/StructureMapException.resx 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap/StructureMapException.resx 2007-02-25 19:29:51 UTC (rev 24)
@@ -231,4 +231,10 @@
<data name="300" xml:space="preserve">
<value>The implied PluginType {0} cannot be found in any of the configured assemblies </value>
</data>
+ <data name="301" xml:space="preserve">
+ <value>No concrete type or concrete key is specified for instance {0} for PluginType {1}</value>
+ </data>
+ <data name="302" xml:space="preserve">
+ <value>There is no argument of type {0} for concrete type {1}</value>
+ </data>
</root>
\ No newline at end of file
Added: trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs (rev 0)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/AddInstanceTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,234 @@
+using System;
+using System.Configuration;
+using NUnit.Framework;
+using StructureMap.Configuration.DSL;
+using StructureMap.Graph;
+using StructureMap.Testing.Widget;
+using IList=System.Collections.IList;
+
+namespace StructureMap.Testing.Configuration.DSL
+{
+ [TestFixture]
+ public class AddInstanceTester
+ {
+ private InstanceManager manager;
+ private PluginGraph pluginGraph;
+
+ [SetUp]
+ public void SetUp()
+ {
+ pluginGraph = new PluginGraph();
+ Registry registry = new Registry(pluginGraph);
+
+ // Add an instance with properties
+ registry.AddInstanceOf<IWidget>()
+ .WithName("DarkGreen")
+ .UsingConcreteType<ColorWidget>()
+ .WithProperty("Color").EqualTo("DarkGreen");
+
+ // Add an instance by specifying the ConcreteKey
+ registry.AddInstanceOf<IWidget>()
+ .WithName("Purple")
+ .UsingConcreteTypeNamed("Color")
+ .WithProperty("Color").EqualTo("Purple");
+
+ // Pull a property from the App config
+ registry.AddInstanceOf<IWidget>()
+ .WithName("AppSetting")
+ .UsingConcreteType<ColorWidget>()
+ .WithProperty("Color").EqualToAppSetting("Color");
+
+
+
+
+ registry.AddInstanceOf<IWidget>().UsingConcreteType<AWidget>();
+
+
+
+
+
+ /*
+
+
+
+ // Build an instance for IWidget, then setup StructureMap to return cloned instances of the
+ // "Prototype" (GoF pattern) whenever someone asks for IWidget named "Jeremy"
+ registry.AddInstanceOf<IWidget>().WithName("Jeremy").UsePrototype(new CloneableWidget("Jeremy"));
+
+ // Return the specific instance when an IWidget named "Julia" is requested
+ registry.AddInstanceOf<IWidget>( new CloneableWidget("Julia") ).WithName("Julia");
+ */
+ manager = registry.BuildInstanceManager();
+ }
+
+
+
+
+ [Test]
+ public void SpecifyANewInstanceWithADependency()
+ {
+ Registry registry = new Registry();
+
+ // Specify a new Instance, create an instance for a dependency on the fly
+ string instanceKey = "OrangeWidgetRule";
+ registry.AddInstanceOf<Rule>().UsingConcreteType<WidgetRule>().WithName(instanceKey)
+ .Child<IWidget>().Is(
+ Registry.Instance<IWidget>().UsingConcreteType<ColorWidget>()
+ .WithProperty("Color").EqualTo("Orange")
+ .WithName("Orange")
+ );
+
+ InstanceManager mgr = registry.BuildInstanceManager();
+
+ ColorWidget orange = (ColorWidget) mgr.CreateInstance<IWidget>("Orange");
+ Assert.IsNotNull(orange);
+
+ WidgetRule rule = (WidgetRule)mgr.CreateInstance<Rule>(instanceKey);
+ ColorWidget widget = (ColorWidget) rule.Widget;
+ Assert.AreEqual("Orange", widget.Color);
+ }
+
+
+ [Test]
+ public void AddInstanceAndOverrideTheConcreteTypeForADependency()
+ {
+ Registry registry = new Registry();
+
+ // Specify a new Instance that specifies the concrete type used for a dependency
+ registry.AddInstanceOf<Rule>().UsingConcreteType<WidgetRule>().WithName("AWidgetRule")
+ .Child<IWidget>().IsConcreteType<AWidget>();
+
+ manager = registry.BuildInstanceManager();
+
+ WidgetRule rule = (WidgetRule)manager.CreateInstance<Rule>("AWidgetRule");
+ Assert.IsInstanceOfType(typeof(AWidget), rule.Widget);
+ }
+
+ [Test]
+ public void AddAnInstanceWithANameAndAPropertySpecifyingConcreteType()
+ {
+ ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>("DarkGreen");
+ Assert.AreEqual("DarkGreen", widget.Color);
+ }
+
+ [Test]
+ public void AddAnInstanceWithANameAndAPropertySpecifyingConcreteKey()
+ {
+ ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>("Purple");
+ Assert.AreEqual("Purple", widget.Color);
+ }
+
+ [Test]
+ public void CreateAnInstancePullAPropertyFromTheApplicationConfig()
+ {
+ Assert.AreEqual("Blue", ConfigurationManager.AppSettings["Color"]);
+ ColorWidget widget = (ColorWidget) manager.CreateInstance<IWidget>("AppSetting");
+ Assert.AreEqual("Blue", widget.Color);
+ }
+
+ [Test]
+ public void SimpleCaseWithNamedInstance()
+ {
+ Registry registry = new Registry();
+
+ // Specify a new Instance and override the Name
+ registry.AddInstanceOf<IWidget>().UsingConcreteType<AWidget>().WithName("MyInstance");
+
+ manager = registry.BuildInstanceManager();
+
+ AWidget widget = (AWidget) manager.CreateInstance<IWidget>("MyInstance");
+ Assert.IsNotNull(widget);
+ }
+
+ [Test]
+ public void SimpleCaseByPluginName()
+ {
+ AWidget widget = (AWidget) manager.CreateInstance<IWidget>("AWidget");
+ Assert.IsNotNull(widget);
+ }
+
+ [Test]
+ public void SpecifyANewInstanceOverrideADependencyWithANamedInstance()
+ {
+ Registry registry = new Registry();
+
+ registry.ScanAssemblies().IncludeAssemblyContainingType<IWidget>();
+
+ registry.AddInstanceOf<Rule>().UsingConcreteType<ARule>().WithName("Alias");
+
+ // Add an instance by specifying the ConcreteKey
+ registry.AddInstanceOf<IWidget>()
+ .WithName("Purple")
+ .UsingConcreteTypeNamed("Color")
+ .WithProperty("Color").EqualTo("Purple");
+
+ // Specify a new Instance, override a dependency with a named instance
+ registry.AddInstanceOf<Rule>().UsingConcreteType<WidgetRule>().WithName("RuleThatUsesMyInstance")
+ .Child("widget").IsNamedInstance("Purple");
+
+ manager = registry.BuildInstanceManager();
+
+ Assert.IsInstanceOfType(typeof(ARule), manager.CreateInstance<Rule>("Alias"));
+
+ WidgetRule rule = (WidgetRule) manager.CreateInstance<Rule>("RuleThatUsesMyInstance");
+ ColorWidget widget = (ColorWidget) rule.Widget;
+ Assert.AreEqual("Purple", widget.Color);
+ }
+ }
+
+
+ public class WidgetRule : Rule
+ {
+ private readonly IWidget _widget;
+
+ public WidgetRule(IWidget widget)
+ {
+ _widget = widget;
+ }
+
+
+ public IWidget Widget
+ {
+ get { return _widget; }
+ }
+ }
+
+ public class WidgetThing : IWidget
+ {
+ public void DoSomething()
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class CloneableWidget : IWidget, ICloneable
+ {
+ private string _name;
+
+
+ public CloneableWidget(string name)
+ {
+ _name = name;
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
+ public void DoSomething()
+ {
+ throw new NotImplementedException();
+ }
+
+ public object Clone()
+ {
+ return MemberwiseClone();
+ }
+ }
+
+ public class ARule : Rule
+ {
+
+ }
+}
\ No newline at end of file
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/CreatePluginFamilyTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -4,16 +4,29 @@
using StructureMap.Configuration.DSL;
using StructureMap.Graph;
using StructureMap.Interceptors;
+using StructureMap.Testing.Widget;
using StructureMap.Testing.Widget3;
namespace StructureMap.Testing.Configuration.DSL
{
- [TestFixture]
+ [TestFixture, Explicit]
public class CreatePluginFamilyTester
{
[SetUp]
public void SetUp()
{
+ PluginGraph pluginGraph = new PluginGraph();
+ using (Registry registry = new Registry(pluginGraph))
+ {
+ // Define the default instance of IWidget
+ registry.BuildInstancesOfType<IWidget>().AndTheDefaultIs(
+ Registry.Instance<IWidget>()
+ .UsingConcreteType<ColorWidget>()
+ .WithProperty("Color").EqualTo("Red")
+ );
+
+
+ }
}
[Test]
@@ -51,6 +64,7 @@
PluginGraph pluginGraph = new PluginGraph();
using (Registry registry = new Registry(pluginGraph))
{
+ // Specify the default implementation for an interface
registry.BuildInstancesOfType<IGateway>().WithDefaultConcreteType<StubbedGateway>();
}
Added: trunk/Source/StructureMap.Testing/Configuration/DSL/CreateProfileTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/CreateProfileTester.cs (rev 0)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/CreateProfileTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,42 @@
+using NUnit.Framework;
+using StructureMap.Configuration.DSL;
+using StructureMap.Graph;
+using StructureMap.Testing.GenericWidgets;
+using StructureMap.Testing.Widget;
+
+namespace StructureMap.Testing.Configuration.DSL
+{
+ [TestFixture]
+ public class CreateProfileTester
+ {
+ private InstanceManager manager;
+ private PluginGraph pluginGraph;
+
+ [SetUp]
+ public void SetUp()
+ {
+ /*
+ pluginGraph = new PluginGraph();
+ Registry registry = new Registry(pluginGraph);
+ registry.ScanAssemblies().IncludeAssemblyContainingType<IWidget>();
+ registry.AddInstanceOf<IWidget>
+ .Called("DarkGreen").OfConcreteType<ColorWidget>.WithProperty("Color").EqualTo("DarkGreen");
+
+
+
+ registry.CreateProfile("Green")
+ .UseConcreteType<SimpleThing<string>>().For<ISimpleThing<string>>()
+
+ .UseInstanceNamed("Green").For<Rule>();
+
+ manager = registry.BuildInstanceManager();
+ */
+ }
+
+ [Test]
+ public void CreateProfile()
+ {
+
+ }
+ }
+}
Added: trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs (rev 0)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/InstanceExpressionTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,25 @@
+using NUnit.Framework;
+using StructureMap.Configuration.DSL;
+using StructureMap.Graph;
+using StructureMap.Testing.Widget;
+
+namespace StructureMap.Testing.Configuration.DSL
+{
+ [TestFixture]
+ public class InstanceExpressionTester
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [Test, ExpectedException(typeof(StructureMapException), "StructureMap Exception Code: 301\nNo concrete type or concrete key is specified for instance TheInstanceKey for PluginType StructureMap.Testing.Widget.IWidget,StructureMap.Testing.Widget")]
+ public void BlowUpIfNoConcreteKeyOrTypeDefinied()
+ {
+ InstanceExpression expression = new InstanceExpression(typeof(IWidget));
+ expression.InstanceKey = "TheInstanceKey";
+ PluginGraph pluginGraph = new PluginGraph();
+ ((IExpression)expression).Configure(pluginGraph);
+ }
+ }
+}
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -23,6 +23,10 @@
IExpression expression1 = mocks.CreateMock<IExpression>();
IExpression expression2 = mocks.CreateMock<IExpression>();
IExpression expression3 = mocks.CreateMock<IExpression>();
+
+ Expect.Call(expression1.ChildExpressions).Return(new IExpression[0]);
+ Expect.Call(expression2.ChildExpressions).Return(new IExpression[0]);
+ Expect.Call(expression3.ChildExpressions).Return(new IExpression[0]);
PluginGraph graph = new PluginGraph();
expression1.Configure(graph);
@@ -31,12 +35,12 @@
mocks.ReplayAll();
- TestRegistry registry = new TestRegistry();
+ TestRegistry registry = new TestRegistry(graph);
registry.AddExpression(expression1);
registry.AddExpression(expression2);
registry.AddExpression(expression3);
- registry.Configure(graph);
+ registry.Dispose();
mocks.VerifyAll();
}
@@ -48,7 +52,11 @@
IExpression expression1 = mocks.CreateMock<IExpression>();
IExpression expression2 = mocks.CreateMock<IExpression>();
IExpression expression3 = mocks.CreateMock<IExpression>();
-
+
+ Expect.Call(expression1.ChildExpressions).Return(new IExpression[0]);
+ Expect.Call(expression2.ChildExpressions).Return(new IExpression[0]);
+ Expect.Call(expression3.ChildExpressions).Return(new IExpression[0]);
+
PluginGraph graph = new PluginGraph();
expression1.Configure(graph);
expression2.Configure(graph);
Modified: trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Container/FullStackFacadeTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -203,7 +203,7 @@
IList list = manager.GetAllInstances(typeof (IWidget));
- Assert.AreEqual(6, list.Count);
+ Assert.AreEqual(7, list.Count);
foreach (object target in list)
{
Modified: trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Container/PluginGraphBuilderTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -163,7 +163,7 @@
public void GotRightNumberOfPluginsForIWidget()
{
PluginFamily pluginFamily = graph.PluginFamilies[typeof (IWidget)];
- Assert.AreEqual(4, pluginFamily.Plugins.Count, "Should be 4 total");
+ Assert.AreEqual(5, pluginFamily.Plugins.Count, "Should be 5 total");
}
Modified: trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Graph/AssemblyGraphTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -44,7 +44,7 @@
AssemblyGraph graph = new AssemblyGraph("StructureMap.Testing.Widget");
Plugin[] plugins = graph.FindPlugins(typeof (IWidget));
Assert.IsNotNull(plugins);
- Assert.AreEqual(3, plugins.Length);
+ Assert.AreEqual(4, plugins.Length);
Assert.AreEqual(DefinitionSource.Implicit, plugins[0].DefinitionSource);
}
Modified: trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -19,7 +19,7 @@
AssemblyGraph graph = new AssemblyGraph("StructureMap.Testing.Widget");
family.SearchAssemblyGraph(graph);
- Assert.AreEqual(3, family.Plugins.Count, "Plugin Count");
+ Assert.AreEqual(4, family.Plugins.Count, "Plugin Count");
foreach (Plugin plugin in family.Plugins)
{
Assert.IsNotNull(plugin);
Modified: trunk/Source/StructureMap.Testing/Graph/PluginGraphTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Graph/PluginGraphTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Graph/PluginGraphTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -66,7 +66,7 @@
Assert.AreEqual("Blue", family.DefaultInstanceKey);
- Assert.AreEqual(3, family.Plugins.Count, "3 different IWidget classes are marked as Pluggable");
+ Assert.AreEqual(4, family.Plugins.Count, "3 different IWidget classes are marked as Pluggable");
}
[Test]
@@ -89,9 +89,9 @@
Assert.IsNotNull(family);
Assert.AreEqual(
- 4,
+ 5,
family.Plugins.Count,
- "4 different IWidget classes are marked as Pluggable, + the manual add");
+ "5 different IWidget classes are marked as Pluggable, + the manual add");
}
[Test]
Modified: trunk/Source/StructureMap.Testing/Graph/PluginTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Graph/PluginTester.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/Graph/PluginTester.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -75,7 +75,7 @@
Plugin[] plugs = Plugin.GetPlugins(assem, typeof (IWidget));
Assert.IsNotNull(plugs);
- Assert.AreEqual(3, plugs.Length);
+ Assert.AreEqual(4, plugs.Length);
}
@@ -294,6 +294,23 @@
Plugin plugin = Plugin.CreateImplicitPlugin(this.GetType());
Assert.AreEqual(TypePath.GetAssemblyQualifiedName(this.GetType()), plugin.ConcreteKey);
}
+
+ [Test]
+ public void FindFirstConstructorArgumentOfType()
+ {
+ Plugin plugin = Plugin.CreateImplicitPlugin(typeof (GrandPrix));
+ string expected = "engine";
+
+ string actual = plugin.FindFirstConstructorArgumentOfType<IEngine>();
+ Assert.AreEqual(expected, actual);
+ }
+
+ [Test, ExpectedException(typeof(StructureMapException), "StructureMap Exception Code: 302\nThere is no argument of type StructureMap.Testing.Widget.IWidget for concrete type StructureMap.Testing.Graph.GrandPrix")]
+ public void FindFirstConstructorArgumentOfTypeNegativeCase()
+ {
+ Plugin plugin = Plugin.CreateImplicitPlugin(typeof(GrandPrix));
+ plugin.FindFirstConstructorArgumentOfType<IWidget>();
+ }
}
[PluginFamily("Pushrod")]
Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj
===================================================================
--- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2007-02-25 19:29:51 UTC (rev 24)
@@ -89,6 +89,7 @@
<Reference Include="System">
<Name>System</Name>
</Reference>
+ <Reference Include="System.configuration" />
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
@@ -183,7 +184,10 @@
<Compile Include="Configuration\DiagnosticGraphBuilderTester.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Configuration\DSL\AddInstanceTester.cs" />
<Compile Include="Configuration\DSL\CreatePluginFamilyTester.cs" />
+ <Compile Include="Configuration\DSL\CreateProfileTester.cs" />
+ <Compile Include="Configuration\DSL\InstanceExpressionTester.cs" />
<Compile Include="Configuration\DSL\RegistryTester.cs" />
<Compile Include="Configuration\DSL\ScanAssembliesTester.cs" />
<Compile Include="Configuration\FamilyParserTester.cs">
@@ -422,6 +426,9 @@
<SubType>Code</SubType>
</Compile>
<None Include="StructureMap.config" />
+ <None Include="StructureMap.Testing.dll.config">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<EmbeddedResource Include="Container\Source\EmbeddedMementoFile.xml" />
<EmbeddedResource Include="Container\Source\Mementos\Instance1.xml" />
<EmbeddedResource Include="Container\Source\Mementos\Instance2.xml" />
Added: trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config
===================================================================
--- trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config (rev 0)
+++ trunk/Source/StructureMap.Testing/StructureMap.Testing.dll.config 2007-02-25 19:29:51 UTC (rev 24)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="Color" value="Blue"/>
+ <add key="Day" value="Monday"/>
+ </appSettings>
+</configuration>
\ No newline at end of file
Modified: trunk/Source/StructureMap.Testing.Widget/IWidget.cs
===================================================================
--- trunk/Source/StructureMap.Testing.Widget/IWidget.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing.Widget/IWidget.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -33,6 +33,20 @@
#endregion
}
+ [Pluggable("AWidget")]
+ public class AWidget : IWidget
+ {
+ public AWidget()
+ {
+ }
+
+
+ public void DoSomething()
+ {
+ throw new NotImplementedException();
+ }
+ }
+
public class NotPluggableWidget : IWidget
{
private readonly string _name;
@@ -42,6 +56,12 @@
_name = name;
}
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
#region IWidget Members
public void DoSomething()
Modified: trunk/Source/StructureMap.Testing.Widget/Rule.cs
===================================================================
--- trunk/Source/StructureMap.Testing.Widget/Rule.cs 2007-02-20 23:09:00 UTC (rev 23)
+++ trunk/Source/StructureMap.Testing.Widget/Rule.cs 2007-02-25 19:29:51 UTC (rev 24)
@@ -152,4 +152,6 @@
get { return _Value; }
}
}
+
+
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|