Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

InstantiationAwareObjectPostProcessorAdapter.PostProcessBeforeInstantiation Method

Apply this IObjectPostProcessorbefore the target object gets instantiated.

[Visual Basic]
Public Overridable Sub PostProcessBeforeInstantiation( _
   ByVal objectType As Type, _
   ByVal objectName As String _
) _
    Implements IInstantiationAwareObjectPostProcessor.PostProcessBeforeInstantiation
[C#]
public virtual object PostProcessBeforeInstantiation(
   Type objectType,
   string objectName
);

Parameters

objectType
The Type of the target object that is to be instantiated.
objectName
The name of the target object.

Return Value

The object to expose instead of a default instance of the target object.

Implements

IInstantiationAwareObjectPostProcessor.PostProcessBeforeInstantiation

Remarks

The returned object may be a proxy to use instead of the target object, effectively suppressing the default instantiation of the target object.

If the object is returned by this method is not a null reference (Nothing in Visual Basic), the object creation process will be short-circuited. The returned object will not be processed any further; in particular, no further IObjectPostProcessor callbacks will be applied to it. This mechanism is mainly intended for exposing a proxy instead of an actual target object.

This callback will only be applied to object definitions with an object class. In particular, it will not be applied to objects with a "factory-method" (i.e. objects that are to be instantiated via a layer of indirection anyway).

Exceptions

Exception Type Condition
ObjectsException In the case of any errors.

See Also

InstantiationAwareObjectPostProcessorAdapter Class | Spring.Objects.Factory.Config Namespace | HasObjectType | FactoryMethodName