public object CreateRemoteInstance(ComponentModel model, CreationContext context, object[] arguments, Type[] signature)
{
object instance;
Type implType = model.Implementation;
if (model.Interceptors.HasInterceptors)
{
try
{
instance = Kernel.ProxyFactory.Create(Kernel, null, model, arguments);
}
catch (Exception ex)
{
throw new ComponentActivatorException("RemoteLoader: could not proxy " + model.Implementation.FullName, ex);
}
}
else
{
try
{
ConstructorInfo cinfo = implType.GetConstructor(
BindingFlags.Public | BindingFlags.Instance, null, signature, null);
instance = FormatterServices.GetUninitializedObject(implType);
cinfo.Invoke(instance, arguments);
}
catch (Exception ex)
{
throw new ComponentActivatorException("RemoteLoader: could not instantiate " + model.Implementation.FullName, ex);
}
}
return instance;
}