SlideShare une entreprise Scribd logo
1  sur  22
AOP with PostSharp NCSoft China PD Dept. training  - Session 4 -- Lance Zhang http://blodfox777.cnblogs.com I am not an AOP expert.
Topics What is AOP Existing AOP Frameworks in .NET Introduce PostSharp  How does PostSharp work How to use PostSharp Q & A
Suppose We have a System… It Grows… Code Smells similar… Now We've Got A Problem(Ctrl + C/V)… So We Concerns…
Application Concerns Functional Requirements Line-of-business. Non-Functional Concerns Logging Caching Transaction Security Validation Persistence …
Enter the Aspect. What is AOP?
Aspects - Reduce noise in source Move plumbing out of source, but keep behaviour the same AOP … doesn’t solve any new problems. is just too complex. adoption is all or nothing. Promotes sloppy design. Aspects … obscure program flow. can’t be unit tested. Debugging with Aspects is hard.
Aspects Lingo Advice The duplicated plumbing code we are removing Typically under 30 lines of code Behaviour that is injected at a join point Join points Places within the code where the Aspect is inserted Examples Entry/Exit of a method or property Class’s Type Definition
Aspects Lingo Point cut Locates Join Points to apply advice Filter  driven– Automatic injection Find all Methods, of type Setter, in all classes where Namespace equals “Application.Entities” Attribute driven – Manual injection
Aspects Lingo Weaving Process of injecting functionality back into a component Can be performed by Text post processor – Magic comments can replaced by code Proxy container – Uses decorator pattern/hooks to allow code to be inserted Binary manipulation - Modifying assemblies - by replacing and injecting IL code
Existing AOP Frameworks in .NET AOP with Castle Windsor Dynamic Proxy Dynamic Proxy does the heavy-lifting of the IL generation for us Much easier for most requirements AOP with Spring.NET Can use something other than attributes such as XML configuration. Sorry, but actually I am unfamiliar with them…
Enter the PostSharp What is PostSharp? ,[object Object]
PostSharp is an Aspect-Oriented Framework,[object Object]
Easy to use  - like normal Attribute 
Intercept any method  - not only Virtual
More Join points  - on: field access, exception
More controllability  - break, change param or return
More transparent- no need “new proxy()”
Multicasting Custom Attributes- filter
Code quality after injection
Complexity of Debug ,[object Object],[object Object],[object Object]
Assembly Before/After Injection  Before Injection ,[object Object],[object Object]
When Can PostSharp Insert Code?  PostSharp.Laos.OnMethodBoundaryAspect OnEntry OnExit OnSuccess OnException PostSharp.Laos.OnMethodInvocationAspect OnInvocation PostSharp.Laos.OnExceptionAspect OnException PostSharp.Laos.OnFieldAccessAspect OnGetValue OnSetValue

Contenu connexe

Tendances

Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineGil Fink
 
Productivity and scalability with Play and Scala
Productivity and scalability with Play and ScalaProductivity and scalability with Play and Scala
Productivity and scalability with Play and ScalaChristophe Marchal
 
Asynchronous Programming in C# - Part 1
Asynchronous Programming in C# - Part 1Asynchronous Programming in C# - Part 1
Asynchronous Programming in C# - Part 1Mindfire Solutions
 
Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Bertrand Delacretaz
 
Solving cross cutting concerns in PHP - PHPSerbia-2017
Solving cross cutting concerns in PHP - PHPSerbia-2017Solving cross cutting concerns in PHP - PHPSerbia-2017
Solving cross cutting concerns in PHP - PHPSerbia-2017Alexander Lisachenko
 
Automated Infrastructure Testing
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure TestingRanjib Dey
 
Mock cli with Python unittest
Mock cli with Python unittestMock cli with Python unittest
Mock cli with Python unittestSong Jin
 
Code quality
Code qualityCode quality
Code quality44ue
 
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016Joe Ferguson
 
Introducing Ghost Inspector
Introducing Ghost InspectorIntroducing Ghost Inspector
Introducing Ghost InspectorNeil Mansilla
 
Automation testing API in Java
Automation testing API in JavaAutomation testing API in Java
Automation testing API in JavaWix.com
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravelDerek Binkley
 

Tendances (20)

AOP on Android
AOP on AndroidAOP on Android
AOP on Android
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 
Paper CS
Paper CSPaper CS
Paper CS
 
Productivity and scalability with Play and Scala
Productivity and scalability with Play and ScalaProductivity and scalability with Play and Scala
Productivity and scalability with Play and Scala
 
0 to Angular in 45 Mins
0 to Angular in 45 Mins0 to Angular in 45 Mins
0 to Angular in 45 Mins
 
Asynchronous Programming in C# - Part 1
Asynchronous Programming in C# - Part 1Asynchronous Programming in C# - Part 1
Asynchronous Programming in C# - Part 1
 
Tdd for php
Tdd for phpTdd for php
Tdd for php
 
Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?
 
Solving cross cutting concerns in PHP - PHPSerbia-2017
Solving cross cutting concerns in PHP - PHPSerbia-2017Solving cross cutting concerns in PHP - PHPSerbia-2017
Solving cross cutting concerns in PHP - PHPSerbia-2017
 
Front-End UnitTesting
Front-End UnitTestingFront-End UnitTesting
Front-End UnitTesting
 
Wax on, wax off
Wax on, wax offWax on, wax off
Wax on, wax off
 
Karate DSL
Karate DSLKarate DSL
Karate DSL
 
Automated Infrastructure Testing
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure Testing
 
Refactoring
RefactoringRefactoring
Refactoring
 
Mock cli with Python unittest
Mock cli with Python unittestMock cli with Python unittest
Mock cli with Python unittest
 
Code quality
Code qualityCode quality
Code quality
 
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016
 
Introducing Ghost Inspector
Introducing Ghost InspectorIntroducing Ghost Inspector
Introducing Ghost Inspector
 
Automation testing API in Java
Automation testing API in JavaAutomation testing API in Java
Automation testing API in Java
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravel
 

En vedette

Performance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatchPerformance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatchYan Cui
 
Hoe iwt subsidie aanvragen
Hoe iwt subsidie aanvragenHoe iwt subsidie aanvragen
Hoe iwt subsidie aanvragenHans Haagdorens
 
Considering flipping
Considering flippingConsidering flipping
Considering flippingdsantur
 
Rangkuman penelitian ilmiah
Rangkuman penelitian ilmiahRangkuman penelitian ilmiah
Rangkuman penelitian ilmiahSigit Yunanto
 
How To Unfreeze iPod Nano or Touch
How To Unfreeze iPod Nano or TouchHow To Unfreeze iPod Nano or Touch
How To Unfreeze iPod Nano or Touchsurfingskimmer7
 
Financial Regulatory Reform: A New Foundation
Financial Regulatory Reform: A New FoundationFinancial Regulatory Reform: A New Foundation
Financial Regulatory Reform: A New FoundationColumbia
 
Bessels Architekten & Ingenieurs: Logistiek Industrie Kantoren
Bessels Architekten & Ingenieurs: Logistiek Industrie KantorenBessels Architekten & Ingenieurs: Logistiek Industrie Kantoren
Bessels Architekten & Ingenieurs: Logistiek Industrie KantorenFrederiek Muller
 
Par Stories 6
Par Stories 6Par Stories 6
Par Stories 6SDuhig
 
How To Add Social Networking Buttons To Your Outlook Email Signature
How To Add Social Networking Buttons To Your Outlook Email SignatureHow To Add Social Networking Buttons To Your Outlook Email Signature
How To Add Social Networking Buttons To Your Outlook Email SignatureAK Stout
 
Digital Portfolio
Digital PortfolioDigital Portfolio
Digital Portfoliotedollier
 
Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...
Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...
Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...Tom Blefko
 
Participate in Sakai 3
Participate in Sakai 3Participate in Sakai 3
Participate in Sakai 3guest1411821
 
How to Successfully Negotiate with a Seller
How to Successfully Negotiate with a SellerHow to Successfully Negotiate with a Seller
How to Successfully Negotiate with a SellerTom Blefko
 
The Path to a Perfect Listing Presentation
The Path to a Perfect Listing PresentationThe Path to a Perfect Listing Presentation
The Path to a Perfect Listing PresentationTom Blefko
 
Res012913p
Res012913pRes012913p
Res012913pSDuhig
 

En vedette (20)

Performance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatchPerformance Monitoring with AOP and Amazon CloudWatch
Performance Monitoring with AOP and Amazon CloudWatch
 
Avery
AveryAvery
Avery
 
Hoe iwt subsidie aanvragen
Hoe iwt subsidie aanvragenHoe iwt subsidie aanvragen
Hoe iwt subsidie aanvragen
 
Considering flipping
Considering flippingConsidering flipping
Considering flipping
 
B Avery
B AveryB Avery
B Avery
 
Rangkuman penelitian ilmiah
Rangkuman penelitian ilmiahRangkuman penelitian ilmiah
Rangkuman penelitian ilmiah
 
How To Unfreeze iPod Nano or Touch
How To Unfreeze iPod Nano or TouchHow To Unfreeze iPod Nano or Touch
How To Unfreeze iPod Nano or Touch
 
i-5 an alternate road to gittin' er done
i-5 an alternate road to gittin' er donei-5 an alternate road to gittin' er done
i-5 an alternate road to gittin' er done
 
IOAについて
IOAについてIOAについて
IOAについて
 
Financial Regulatory Reform: A New Foundation
Financial Regulatory Reform: A New FoundationFinancial Regulatory Reform: A New Foundation
Financial Regulatory Reform: A New Foundation
 
Bessels Architekten & Ingenieurs: Logistiek Industrie Kantoren
Bessels Architekten & Ingenieurs: Logistiek Industrie KantorenBessels Architekten & Ingenieurs: Logistiek Industrie Kantoren
Bessels Architekten & Ingenieurs: Logistiek Industrie Kantoren
 
Par Stories 6
Par Stories 6Par Stories 6
Par Stories 6
 
How To Add Social Networking Buttons To Your Outlook Email Signature
How To Add Social Networking Buttons To Your Outlook Email SignatureHow To Add Social Networking Buttons To Your Outlook Email Signature
How To Add Social Networking Buttons To Your Outlook Email Signature
 
Siguiendo el modelo
Siguiendo el modeloSiguiendo el modelo
Siguiendo el modelo
 
Digital Portfolio
Digital PortfolioDigital Portfolio
Digital Portfolio
 
Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...
Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...
Using Video, High-Definition Photography, and 3-D Walkthroughs to Market Real...
 
Participate in Sakai 3
Participate in Sakai 3Participate in Sakai 3
Participate in Sakai 3
 
How to Successfully Negotiate with a Seller
How to Successfully Negotiate with a SellerHow to Successfully Negotiate with a Seller
How to Successfully Negotiate with a Seller
 
The Path to a Perfect Listing Presentation
The Path to a Perfect Listing PresentationThe Path to a Perfect Listing Presentation
The Path to a Perfect Listing Presentation
 
Res012913p
Res012913pRes012913p
Res012913p
 

Similaire à Aop With Post Sharp

Aspect oriented programming in .Net
Aspect oriented programming in .NetAspect oriented programming in .Net
Aspect oriented programming in .NetPaul Fryer
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKAJohan Edstrom
 
Aspect oriented programming
Aspect oriented programmingAspect oriented programming
Aspect oriented programmingRobert MacLean
 
Spring.Net, Feb 2008, PostSharp: A Technical Introduction
Spring.Net, Feb 2008, PostSharp:  A Technical IntroductionSpring.Net, Feb 2008, PostSharp:  A Technical Introduction
Spring.Net, Feb 2008, PostSharp: A Technical Introductiongfraiteur
 
Aspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency InjectionAspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency InjectionRobert Lemke
 
Serverless in production, an experience report (CoDe-Conf)
Serverless in production, an experience report (CoDe-Conf)Serverless in production, an experience report (CoDe-Conf)
Serverless in production, an experience report (CoDe-Conf)Yan Cui
 
AWS Lambda from the trenches
AWS Lambda from the trenchesAWS Lambda from the trenches
AWS Lambda from the trenchesYan Cui
 
Jstorm introduction-0.9.6
Jstorm introduction-0.9.6Jstorm introduction-0.9.6
Jstorm introduction-0.9.6longda feng
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleArnaud LEMAIRE
 
Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Yan Cui
 
Fuzzing Linux Kernel
Fuzzing Linux KernelFuzzing Linux Kernel
Fuzzing Linux KernelPiyush Mishra
 
Asynchronous Service Server
Asynchronous Service ServerAsynchronous Service Server
Asynchronous Service Serverguestbba9241
 
Aspect j introduction for non-programmers
Aspect j introduction for non-programmersAspect j introduction for non-programmers
Aspect j introduction for non-programmersTamas Rev
 
Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Yan Cui
 
Spring - Part 3 - AOP
Spring - Part 3 - AOPSpring - Part 3 - AOP
Spring - Part 3 - AOPHitesh-Java
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with PythonAbhay Bhargav
 
RxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programmingRxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programmingMaciej Kołek
 

Similaire à Aop With Post Sharp (20)

Aspect oriented programming in .Net
Aspect oriented programming in .NetAspect oriented programming in .Net
Aspect oriented programming in .Net
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKA
 
Aspect oriented programming
Aspect oriented programmingAspect oriented programming
Aspect oriented programming
 
Spring.Net, Feb 2008, PostSharp: A Technical Introduction
Spring.Net, Feb 2008, PostSharp:  A Technical IntroductionSpring.Net, Feb 2008, PostSharp:  A Technical Introduction
Spring.Net, Feb 2008, PostSharp: A Technical Introduction
 
Aspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency InjectionAspect-Oriented Programming and Depedency Injection
Aspect-Oriented Programming and Depedency Injection
 
Serverless in production, an experience report (CoDe-Conf)
Serverless in production, an experience report (CoDe-Conf)Serverless in production, an experience report (CoDe-Conf)
Serverless in production, an experience report (CoDe-Conf)
 
Spring AOP
Spring AOPSpring AOP
Spring AOP
 
AWS Lambda from the trenches
AWS Lambda from the trenchesAWS Lambda from the trenches
AWS Lambda from the trenches
 
WoMakersCode 2016 - Shit Happens
WoMakersCode 2016 -  Shit HappensWoMakersCode 2016 -  Shit Happens
WoMakersCode 2016 - Shit Happens
 
Jstorm introduction-0.9.6
Jstorm introduction-0.9.6Jstorm introduction-0.9.6
Jstorm introduction-0.9.6
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & Ansible
 
Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)
 
Fuzzing Linux Kernel
Fuzzing Linux KernelFuzzing Linux Kernel
Fuzzing Linux Kernel
 
Asynchronous Service Server
Asynchronous Service ServerAsynchronous Service Server
Asynchronous Service Server
 
Aspect j introduction for non-programmers
Aspect j introduction for non-programmersAspect j introduction for non-programmers
Aspect j introduction for non-programmers
 
Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)
 
Spring - Part 3 - AOP
Spring - Part 3 - AOPSpring - Part 3 - AOP
Spring - Part 3 - AOP
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
RxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programmingRxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programming
 

Dernier

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Dernier (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Aop With Post Sharp

  • 1. AOP with PostSharp NCSoft China PD Dept. training - Session 4 -- Lance Zhang http://blodfox777.cnblogs.com I am not an AOP expert.
  • 2. Topics What is AOP Existing AOP Frameworks in .NET Introduce PostSharp  How does PostSharp work How to use PostSharp Q & A
  • 3. Suppose We have a System… It Grows… Code Smells similar… Now We've Got A Problem(Ctrl + C/V)… So We Concerns…
  • 4. Application Concerns Functional Requirements Line-of-business. Non-Functional Concerns Logging Caching Transaction Security Validation Persistence …
  • 5. Enter the Aspect. What is AOP?
  • 6. Aspects - Reduce noise in source Move plumbing out of source, but keep behaviour the same AOP … doesn’t solve any new problems. is just too complex. adoption is all or nothing. Promotes sloppy design. Aspects … obscure program flow. can’t be unit tested. Debugging with Aspects is hard.
  • 7. Aspects Lingo Advice The duplicated plumbing code we are removing Typically under 30 lines of code Behaviour that is injected at a join point Join points Places within the code where the Aspect is inserted Examples Entry/Exit of a method or property Class’s Type Definition
  • 8. Aspects Lingo Point cut Locates Join Points to apply advice Filter driven– Automatic injection Find all Methods, of type Setter, in all classes where Namespace equals “Application.Entities” Attribute driven – Manual injection
  • 9. Aspects Lingo Weaving Process of injecting functionality back into a component Can be performed by Text post processor – Magic comments can replaced by code Proxy container – Uses decorator pattern/hooks to allow code to be inserted Binary manipulation - Modifying assemblies - by replacing and injecting IL code
  • 10. Existing AOP Frameworks in .NET AOP with Castle Windsor Dynamic Proxy Dynamic Proxy does the heavy-lifting of the IL generation for us Much easier for most requirements AOP with Spring.NET Can use something other than attributes such as XML configuration. Sorry, but actually I am unfamiliar with them…
  • 11.
  • 12.
  • 13. Easy to use - like normal Attribute 
  • 14. Intercept any method - not only Virtual
  • 15. More Join points - on: field access, exception
  • 16. More controllability - break, change param or return
  • 17. More transparent- no need “new proxy()”
  • 19. Code quality after injection
  • 20.
  • 21.
  • 22. When Can PostSharp Insert Code?  PostSharp.Laos.OnMethodBoundaryAspect OnEntry OnExit OnSuccess OnException PostSharp.Laos.OnMethodInvocationAspect OnInvocation PostSharp.Laos.OnExceptionAspect OnException PostSharp.Laos.OnFieldAccessAspect OnGetValue OnSetValue
  • 23. Other Aspects PostSharp.Laos.ImplementMethodAspect  Replace a method’s content with the advice in the aspect Useful for modifying 3rd party components PostSharp.Laos.CompositionAspect Allows an interface/state to be injected into a component Used to simulate multiple inheritance Examples include Adding .NET Win Form data binding to a POCO Adding Entity Framework interfaces to a POCO
  • 24. References PostSharp - David Ross Introduction to AOP with PostSharp - Michael D. Hall What Is PostSharp? - http://www.postsharp.org Using AOP and PostSharp to Enhance Your Code: Part A - Doron's .NET Space PostSharp - Lightweight Aspect-Oriented System - http://www.rainsts.net/
  • 25. Learn more... http://www.postsharp.org/ http://davybrion.com/blog/category/postsharp/ http://www.codeplex.com/ValidationAspects http://www.eclipse.org/aspectj/doc/released/progguide/