Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

AbstractObjectFactory.AddSingleton Method

Adds the supplied singleton (object) to this factory's singleton cache.

[Visual Basic]
Protected Overridable Sub AddSingleton( _
   ByVal name As String, _
   ByVal singleton As Object _
)
[C#]
protected virtual void AddSingleton(
   string name,
   object singleton
);

Parameters

name
The name of the object.
singleton
The singleton object.

Remarks

To be called for eager registration of singletons, e.g. to be able to resolve circular references.

Note    If a singleton has already been registered under the same name as the supplied name, then the old singleton will be replaced.

Exceptions

Exception Type Condition
ArgumentNullException If the name argument is a null reference (Nothing in Visual Basic) or consists wholly of whitespace characters; or if the singleton is a null reference (Nothing in Visual Basic).

See Also

AbstractObjectFactory Class | Spring.Objects.Factory.Support Namespace