ProxyGroup<S>
using Castle.DynamicProxy;
using Castle.MicroKernel.ModelBuilder.Descriptors;
using System;
namespace Castle.MicroKernel.Registration.Proxy
{
public class ProxyGroup<S> : RegistrationGroup<S> where S : class
{
public ComponentRegistration<S> AsMarshalByRefClass => AddAttributeDescriptor("marshalByRefProxy", bool.TrueString);
public ProxyGroup(ComponentRegistration<S> registration)
: base(registration)
{
}
public ComponentRegistration<S> AdditionalInterfaces(params Type[] interfaces)
{
if (interfaces != null && interfaces.Length != 0)
AddDescriptor(new ProxyInterfacesDescriptor(interfaces));
return base.Registration;
}
public ComponentRegistration<S> Hook(IProxyGenerationHook hook)
{
return Hook((Action<ItemRegistration<IProxyGenerationHook>>)delegate(ItemRegistration<IProxyGenerationHook> r) {
r.Instance(hook);
});
}
public ComponentRegistration<S> Hook(Action<ItemRegistration<IProxyGenerationHook>> hookRegistration)
{
ItemRegistration<IProxyGenerationHook> itemRegistration = new ItemRegistration<IProxyGenerationHook>();
hookRegistration(itemRegistration);
AddDescriptor(new ProxyHookDescriptor(itemRegistration.Item));
return base.Registration;
}
public ComponentRegistration<S> MixIns(params object[] mixIns)
{
return MixIns(delegate(MixinRegistration r) {
r.Objects(mixIns);
});
}
public ComponentRegistration<S> MixIns(Action<MixinRegistration> mixinRegistration)
{
MixinRegistration mixinRegistration2 = new MixinRegistration();
mixinRegistration(mixinRegistration2);
AddDescriptor(new ProxyMixInsDescriptor(mixinRegistration2));
return base.Registration;
}
}
}