Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ObjectFactoryCreatingFactoryObject Class

Returns a value that is an IGenericObjectFactory that returns an object from an IObjectFactory.

For a list of all members of this type, see ObjectFactoryCreatingFactoryObject Members .

System.Object
   AbstractFactoryObject
      ObjectFactoryCreatingFactoryObject

[Visual Basic]
<Serializable> _
Public Class ObjectFactoryCreatingFactoryObject
    Inherits AbstractFactoryObject
    Implements IObjectFactoryAware
[C#]
[Serializable]
public class ObjectFactoryCreatingFactoryObject : AbstractFactoryObject, IObjectFactoryAware

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The primary motivation of this class is to avoid having a client object directly calling the GetObject method to get a prototype object out of an IObjectFactory, which would be a violation of the inversion of control principle. With the use of this class, the client object can be fed an IObjectFactory as a property that directly returns one target prototype object.

The object referred to by the value of the TargetObjectName property does not have to be a prototype object, but there is little to no point in using this class in conjunction with a singleton object.

Example

The following XML configuration snippet illustrates the use of this class...

  <objects>
    <!-- prototype object since we have state -->
    <object id="MyService" type="A.B.C.MyService" singleton="false" />
    <object id="MyServiceFactory" type="Spring.Objects.Factory.Config.ObjectFactoryCreatingFactoryObject">
      <property name="TargetObjectName">
        <idref local="MyService" />
      </property>
    </object>
    <object id="MyClientObject" type="A.B.C.MyClientObject">
      <property name="MyServiceFactory" ref="MyServiceFactory" />
    </object>
  </objects>

Requirements

Namespace: Spring.Objects.Factory.Config

Assembly: Spring.Core (in Spring.Core.dll)

See Also

ObjectFactoryCreatingFactoryObject Members | Spring.Objects.Factory.Config Namespace