AOP C # in action (continued 1)

zhaozj2021-02-12  151

Today, I started considering the C # implementation of AOP, which is confused for static Weavor methods. Is the woven of the source code to do like aspectj, or another way? I have to let me have a headache at the beginning.

The aspectj method is: parsing the source code, then insert the ASPCET code in the join point (JoinPoint), form an intermediate file, and compile into the final file. This method is better than the performance, and one defect is to recompile if it modifies the rules of Weaving. (Perhaps some design patterns can be used to eliminate this weaknesses)

Another idea is that the design mode is inserted. Insert Delegate at JontPoint, if you need to modify the rules, do not need to recompilate the source code, just modify the XML's Aspect description file. The disadvantage is that delegate has system overhead, so performance is not as good as the previous method. It's really hard to go, is it two ways? Headache ing ...

转载请注明原文地址:https://www.9cbs.com/read-7119.html

New Post(0)