Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

EnterpriseServicesExporter.CreateSpringServicedComponentType Method

Creates the SpringServicedComponent base class to derive all ServicedComponents from.

[Visual Basic]
Public Shared Sub CreateSpringServicedComponentType( _
   ByVal module As ModuleBuilder, _
   ByVal baseType As Type _
)
[C#]
public static Type CreateSpringServicedComponentType(
   ModuleBuilder module,
   Type baseType
);

Example

internal class SpringServicedComponent: BaseType
{
   protected delegate object GetObjectHandler(ServicedComponent servicedComponent, string targetName);

   protected static readonly GetObjectHandler getObjectRef;
        
   static SpringServicedComponent()
   {
     // first look for a local copy
     System.Reflection.Assembly servicesAssembly;
     string servicesAssemblyPath = Path.Combine(
                                new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName
                                , "Spring.Services.dll" );
     servicesAssembly = System.Reflection.Assembly.LoadFrom(servicesAssemblyPath);
     if (servicesAssembly == null)
     {
       // then let the normal loader handle the typeload
       servicesAssembly = System.Reflection.Assembly.Load("Spring.Services, culture=neutral, version=x.x.x.x, publicKey=xxxxxxxx");
     }

     Type componentHelperType = servicesAssembly.GetType("Spring.EnterpriseServices.ServicedComponentHelper");
     getObjectRef = (GetObjectHandler) Delegate.CreateDelegate(typeof(GetObjectHandler)
                                                                        , componentHelperType.GetMethod("GetObject"));
   }        
}

See Also

EnterpriseServicesExporter Class | Spring.EnterpriseServices Namespace