Is it possible to generate dynamic proxy for static class or static method in C#?
Posted
by Jeffrey
on Stack Overflow
See other posts from Stack Overflow
or by Jeffrey
Published on 2010-04-23T02:07:54Z
Indexed on
2010/04/23
2:33 UTC
Read the original article
Hit count: 419
I am trying to come up with a way that (either static or instance) method calls can be intercepted by dynamic proxy. I want to implement it as c# extension methods but stuck on how to generate dynamic proxy for static methods.
Some usages:
Repository.GetAll<T>().CacheForMinutes(10);
Repository.GetAll<T>().LogWhenErrorOccurs();
//or
var repo = new Repository();
repo.GetAll<T>().CacheForMinutes(10);
repo.GetAll<T>().LogWhenErrorOccurs();
I am open to any library (linfu, castle.dynamic proxy 2 or etc).
Thanks!
© Stack Overflow or respective owner