|
From: <jer...@us...> - 2009-12-29 17:15:05
|
Revision: 318
http://structuremap.svn.sourceforge.net/structuremap/?rev=318&view=rev
Author: jeremydmiller
Date: 2009-12-29 17:14:57 +0000 (Tue, 29 Dec 2009)
Log Message:
-----------
last minute fixes for scanning, ObjectInstance.ConcreteType, PluginFamily.AddType()
Modified Paths:
--------------
trunk/Source/StructureMap/Configuration/DSL/Expressions/GenericFamilyExpression.cs
trunk/Source/StructureMap/Graph/PluginFamily.cs
trunk/Source/StructureMap/Pipeline/ObjectInstance.cs
trunk/Source/StructureMap/Query/IModel.cs
trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs
Modified: trunk/Source/StructureMap/Configuration/DSL/Expressions/GenericFamilyExpression.cs
===================================================================
--- trunk/Source/StructureMap/Configuration/DSL/Expressions/GenericFamilyExpression.cs 2009-12-29 14:40:45 UTC (rev 317)
+++ trunk/Source/StructureMap/Configuration/DSL/Expressions/GenericFamilyExpression.cs 2009-12-29 17:14:57 UTC (rev 318)
@@ -140,7 +140,6 @@
/// <summary>
/// Configure this type as the supplied value
/// </summary>
- /// <param name="instance"></param>
/// <returns></returns>
public ObjectInstance Add(object @object)
{
Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs
===================================================================
--- trunk/Source/StructureMap/Graph/PluginFamily.cs 2009-12-29 14:40:45 UTC (rev 317)
+++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2009-12-29 17:14:57 UTC (rev 318)
@@ -294,11 +294,16 @@
return templatedFamily;
}
+ private bool hasType(Type concreteType)
+ {
+ return FindPlugin(concreteType) != null || _instances.Any(x => x.ConcreteType == concreteType);
+ }
+
public void AddType(Type concreteType)
{
if (!concreteType.CanBeCastTo(_pluginType)) return;
- if (FindPlugin(concreteType) == null)
+ if (!hasType(concreteType))
{
AddPlugin(concreteType);
}
@@ -308,7 +313,7 @@
{
if (!concreteType.CanBeCastTo(_pluginType)) return;
- if (FindPlugin(name) == null)
+ if (!hasType(concreteType))
{
AddPlugin(concreteType, name);
}
Modified: trunk/Source/StructureMap/Pipeline/ObjectInstance.cs
===================================================================
--- trunk/Source/StructureMap/Pipeline/ObjectInstance.cs 2009-12-29 14:40:45 UTC (rev 317)
+++ trunk/Source/StructureMap/Pipeline/ObjectInstance.cs 2009-12-29 17:14:57 UTC (rev 318)
@@ -63,5 +63,10 @@
{
return string.Format("LiteralInstance: {0}", _object);
}
+
+ protected override Type getConcreteType(Type pluginType)
+ {
+ return _object.GetType();
+ }
}
}
\ No newline at end of file
Modified: trunk/Source/StructureMap/Query/IModel.cs
===================================================================
--- trunk/Source/StructureMap/Query/IModel.cs 2009-12-29 14:40:45 UTC (rev 317)
+++ trunk/Source/StructureMap/Query/IModel.cs 2009-12-29 17:14:57 UTC (rev 318)
@@ -10,7 +10,7 @@
public interface IModel
{
/// <summary>
- /// Access to all the <seealso cref="PluginTypeConfiguration">Plugin Type</seealso> registrations
+ /// Access to all the <seealso cref="IPluginTypeConfiguration">Plugin Type</seealso> registrations
/// </summary>
IEnumerable<IPluginTypeConfiguration> PluginTypes { get; }
@@ -35,14 +35,14 @@
bool HasDefaultImplementationFor<T>();
/// <summary>
- /// Queryable access to all of the <see cref="IInstance">IInstance</see> for a given PluginType
+ /// Queryable access to all of the <see cref="InstanceRef">InstanceRef</see> for a given PluginType
/// </summary>
/// <param name="pluginType"></param>
/// <returns></returns>
IEnumerable<InstanceRef> InstancesOf(Type pluginType);
/// <summary>
- /// Queryable access to all of the <see cref="IInstance">IInstance</see> for a given PluginType
+ /// Queryable access to all of the <see cref="InstanceRef">InstanceRef</see> for a given PluginType
/// </summary>
/// <returns></returns>
IEnumerable<InstanceRef> InstancesOf<T>();
Modified: trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs 2009-12-29 14:40:45 UTC (rev 317)
+++ trunk/Source/StructureMap.Testing/Configuration/DSL/RegistryIntegratedTester.cs 2009-12-29 17:14:57 UTC (rev 318)
@@ -14,8 +14,12 @@
{
ObjectFactory.Initialize(x =>
{
+ x.IgnoreStructureMapConfig = true;
+
x.Scan(s =>
{
+
+
s.AssemblyContainingType<RedGreenRegistry>();
s.LookForRegistries();
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|