Revision: 197
http://structuremap.svn.sourceforge.net/structuremap/?rev=197&view=rev
Author: flimflan
Date: 2008-12-17 04:35:54 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
TryGetInstance is now available on ObjectFactory
Modified Paths:
--------------
trunk/Source/StructureMap/ObjectFactory.cs
Modified: trunk/Source/StructureMap/ObjectFactory.cs
===================================================================
--- trunk/Source/StructureMap/ObjectFactory.cs 2008-12-17 04:00:59 UTC (rev 196)
+++ trunk/Source/StructureMap/ObjectFactory.cs 2008-12-17 04:35:54 UTC (rev 197)
@@ -371,5 +371,51 @@
{
return container.GetInstance<T>(args);
}
+
+ /// <summary>
+ /// Creates or finds the named instance of the pluginType. Returns null if the named instance is not known to the container.
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <param name="instanceKey"></param>
+ /// <param name="instance"></param>
+ /// <returns></returns>
+ public object TryGetInstance(Type pluginType, string instanceKey)
+ {
+ return container.TryGetInstance(pluginType, instanceKey);
+ }
+
+ /// <summary>
+ /// Creates or finds the default instance of the pluginType. Returns null if the pluginType is not known to the container.
+ /// </summary>
+ /// <param name="pluginType"></param>
+ /// <param name="instance"></param>
+ /// <returns></returns>
+ public object TryGetInstance(Type pluginType)
+ {
+ return container.TryGetInstance(pluginType);
+ }
+
+ /// <summary>
+ /// Creates or finds the default instance of type T. Returns the default value of T if it is not known to the container.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="instance"></param>
+ /// <returns></returns>
+ public T TryGetInstance<T>()
+ {
+ return container.TryGetInstance<T>();
+ }
+
+ /// <summary>
+ /// Creates or finds the named instance of type T. Returns the default value of T if the named instance is not known to the container.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="instance"></param>
+ /// <returns></returns>
+ public T TryGetInstance<T>(string instanceKey)
+ {
+ return container.TryGetInstance<T>(instanceKey);
+ }
+
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|