cleanaop--Introduction
立地(欧文)邮箱:[email protected]
Lead:
AOP is the abbreviation for Aspect oriented programming. Programming for facets. Code for logging, performance statistics, security control, transaction processing, exception handling, and so on, is separated from the business logic code by separating these behaviors from the non-directing business logic, and then changing the behavior without affecting the code of the business logic.
One: Understanding AOP
In everyday programming tasks, a lot of the code is to do some common functions (log, detection, layer processing, etc.), and then the code is a mechanical copy and paste, the actual business logic code only accounted for a limited share. Then, AOP can better organize common code, and then let a method in a markup way, so that the business logic and common code separation, so that it does not affect each other.
Advantages of using AOP
- Easy to extend new facets.
- The business logic is decoupled from the facet logic.
- Closed for modification, open to expansion.
CLEANAOP supported languages
Version history current version: v1.0.0
- v1.0.0: Frame completion, support synchronous asynchronous, provide demo plane (Error capture, log, time record), and front and back slice selection.
Where to download?
- GitHub Address: HTTPS://GITHUB.COM/JARVIN-GUAN/CLEANAOP#CLEANAOP
- NET disk Download: http://pan.baidu.com/s/1dD4pp1f
Demo Test Case
-
multi-slice, sync
[trycatchattrubute][logaopattrubute][timeaop]public virtual void Doword () {throw new Exception ("Error test"); Debug.WriteLine ("123");}
Result:
The start catching exception ([Trycatchattrubute]) starts execution ([Logaopattrubute]) 2015/11/5 0:47:19 ([TIMEAOP]) Error test (Exception capture processing) Execution ([ Logaopattrubute]) execution ends, Void Doword () method ([Logaopattrubute]) 2015/11/4 23:47:19 [TIMEAOP])
-
Multi-faceted, asynchronous
[trycatchattrubute][logaopattrubute][timeaop]public virtual async Task Doword () {await getvalueasync ( 1234.5123, 1.01); Debug.WriteLine ("123"); throw new Exception ("Error test"); Debug.WriteLine ("123");}
Result:
Start Catching exception ([Trycatchattrubute]) Start execution ([Logaopattrubute]) 2015/11/5 1:05:23 ([TIMEAOP]) in execution ([Logaopattrubute] ) 123 processing error, error message: Error test ([Trycatchattrubute]) execution end, System.Threading.Tasks.Task Doword () method ([Logaopattrubute]) 2015/11/5 0:05:23 ([TIMEAOP])
. NET AOP Mini-Framework release--CLEANAOP