Friday, 15 July 2011

c# - AOP interception attribute -


Therefore, I have this problem, and no one is able to help. So instead of keeping it away, I'm going to throw it out for alternative cat skin alternatives.

I currently have the following:

  Public Interface ICustomerService {Customer Customer (Int id); } Public Sector Customer Service: IC Customer Service {Public Customer GetCustomer (int id) {...}}  

... and IOC setup with unity, and at the same time interception Configuring:

IUnityContainer ioc = New Unity Container (); Ioc.RegisterType & lt; ICustomerService, CustomerService & gt; (). Configure & lt; Interception & gt; () .SetInterceptorFor & lt; ICustomerService & gt; (New interface interceptor ());

What I want to do is to be able to set up features in the interface like this:

  Public Interface ICustomerService {[Log] Customer GetCustomer ( Int id); }  

... such as definition:

  public class log attitudes: handler attribute {create public override icill handlerHandler (IUNTT container) {return new loghoulder ( ); }}  

... and then I want to logging all the logHandler class which I like:

  public class logheader: icillhandler {public return return What is a tracing / logging system where I want to receive namespace.class where the handler log has been named (IncognitionInvocation Input, GetNextHandlerDelegate getNext) {... Log Content}}  

Methodname, and parent namespace.clas.this is the name that is called. I have not made any attempt to use the "input" iptv invocation parameter, whose information I want, this issue gives input, the "ICustomerService" interface, while parents checking for a stackframe for parents Implemented class (e.g. customer service) means that when I try to create a tree structure as the use of namespace.class.methodname in the form of units ID, then the ID and the parent found Does not.

[Parameter] The attribute is not really working, because what can I put there? If I put the name of the interface, then I still have the same problem where one has an ID interface and the parent is the implementation class. And, I can not put the name of the implementation class in the attribute on the interface, because it has dashed the purpose of having an interface in the first place!

So, this dilemma has anyone got fresh ideas?

I have finished using PostSharp to implement logging in this way.


No comments:

Post a Comment