C#/Resharper 5 structural search, detect and warn if any non-virtual public methods on classes with
- by chillitom
Hi All,
I'm using LinFu's dynamic proxy to add some advice to some classes. The problem is that the proxied objects can only intercept virtual methods and will return the return type's default value for non-virtual methods.
I can tell whether a class is proxied or not based whether the class or any of it's method has an interception attribute, e.g. [Transaction]
Is it possible to write a ReSharper 5 structural search that would warn if any non-virtual public methods are defined on a class with an interception attribute.
E.g.
Ok
public class InterceptedClass
{
[Transaction]
public virtual void TransactionalMethod()
{
...
}
public virtual void AnotherMethod()
{
...
}
}
Bad
public class InterceptedClass
{
[Transaction]
public virtual void TransactionalMethod()
{
...
}
public void AnotherMethod() // non-virtual method will not be called by proxy
{
...
}
}
Many Thanks.