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 _
protected virtual void AddSingleton(
   string name,
   object singleton


The name of the object.
The singleton object.


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.


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