Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

IObjectFactory.Item Property

Return an instance (possibly shared or independent) of the given object name.

[Visual Basic]
Public MustOverride ReadOnly Property Item( _
   ByVal name As String _
) As Object
   Public Get
   End Get
End Property
[C#]
public object this[
   string name
] { public get; }

Parameters

name
The name of the object to return.

Remarks

This method allows an object factory to be used as a replacement for the Singleton or Prototype design pattern.

Note that callers should retain references to returned objects. There is no guarantee that this method will be implemented to be efficient. For example, it may be synchronized, or may need to run an RDBMS query.

Will ask the parent factory if the object cannot be found in this factory instance.

This is the indexer for the IObjectFactory interface.

Exceptions

Exception Type Condition
NoSuchObjectDefinitionException If there's no such object definition.
ObjectsException If the object could not be created.

See Also

IObjectFactory Interface | Spring.Objects.Factory Namespace