[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class AuditAttribute : InterceptAttribute
{
public AuditAttribute()
:base(typeof(AuditInterceptor))
{
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class LogAttribute : InterceptAttribute
{
public LogAttribute()
:base(typeof(LogInterceptor))
{
}
}
And using it like this :
[Audit]
[Log]
public class MyClass
It's much better and simpler than having this:
[Intercept(typeof(AuditInterceptor))]
[Intercept(typeof(LogInterceptor))]
public class MyClass
But for me to do that I need the class InterceptAttribute to be a non sealed class.
The non sealed class would have big advantages compared to the sealed class.
Much easy to understand and much easy to maintain. I would be using my own code.
Just think that if I want to change the class AuditInterceptor to AuditAndEventLogInterceptor, I would have to change it in one place, while using InterceptAttribute I would need to find and replace on every class that I'm using InterceptAttribute and on every module. As you might imagine this might not be practical.
I would like to have something like this:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] public class AuditAttribute : InterceptAttribute { public AuditAttribute() :base(typeof(AuditInterceptor)) { } }
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] public class LogAttribute : InterceptAttribute { public LogAttribute() :base(typeof(LogInterceptor)) { } }
And using it like this :
[Audit] [Log] public class MyClass
It's much better and simpler than having this:
[Intercept(typeof(AuditInterceptor))] [Intercept(typeof(LogInterceptor))] public class MyClass
But for me to do that I need the class InterceptAttribute to be a non sealed class. The non sealed class would have big advantages compared to the sealed class.
Thanks