Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ServicedComponentExporter.CreateWrapperType Method

Creates ServicedComponent wrapper around target class.

[Visual Basic]
Public Sub CreateWrapperType( _
   ByVal module As ModuleBuilder, _
   ByVal baseType As Type, _
   ByVal targetType As Type, _
   ByVal springManagedLifecycle As Boolean _
)
[C#]
public Type CreateWrapperType(
   ModuleBuilder module,
   Type baseType,
   Type targetType,
   bool springManagedLifecycle
);

Parameters

module
Dynamic module builder to use
baseType
targetType
Type of the exported object.
springManagedLifecycle
whether to generate lookups in ContextRegistry for each service method call or use a 'new'ed target instance

Remarks

if springManagedLifecycle is true, each ServicedComponent method call will look similar to

class MyServicedComponent {
  void MethodX() {
    ContextRegistry.GetContext().GetObject("TargetName").MethodX();
  }
}

if springManagedLifecycle is false, the instance will be simply created at component activation using 'new':
class MyServicedComponent {
  TargetType target = new TargetType();

  void MethodX() {
    target.MethodX();
  }
}

The differences are of course that in the former case, the target lifecycle is entirely managed by Spring, thus avoiding issues with ServiceComponent activation/deactivation as well as removing the need for default constructors.

See Also

ServicedComponentExporter Class | Spring.EnterpriseServices Namespace