Castle.Core.AsyncInterceptor icon indicating copy to clipboard operation
Castle.Core.AsyncInterceptor copied to clipboard

How to register interfaces in batches

Open apchenjun opened this issue 4 years ago • 0 comments

I have many interfaces how to register in batches, for example, I want to register all warehouse interfaces. inherit AsyncInterceptorBase or IAsyncInterceptor ,can not be used .EnableInterfaceInterceptors().InterceptedBy(typeof(TransactionalInterceptor))

var myClass = new ClasThatImplementsIMyInterface();
var generator = new ProxyGenerator();
var interceptor = new ClasThatExtendsAsyncInterceptorBase();
IMyInterface proxy = generator.CreateInterfaceProxyWithTargetInterface<IMyInterface>(myClass, interceptor)

apchenjun avatar Sep 02 '21 10:09 apchenjun