Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

AspectSharp

License

NotificationsYou must be signed in to change notification settings

Eleanor68/AspectSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is aPROOF OF CONCEPT project which intends to enable the Aspect-Oriented Programming (AOP) for C#.

The Aspect-Oriented Framework

Pointcuts Syntax

CodeGen and Meta-Programming

Extend instance class

publicclassClass{publicintProperty{get;set;}publicvoidMethod(){}}publicclassClassExtension:ExtensionBase<Class>{publicClassExtension(Classextension):base(extension){}publicintNewProperty{get;set;}publicvoidNewMethod(){Extension.Method();}}//somewhere in the source codevarc=newClass();c.Property=0;//magic happens behind the scenec.NewProperty=0;c.NewMethod();

The power of this idea is the integration with Design-Time and Background build from Visual Studio. This will allow the developer to see live changes in the Visual Studio.

How does it work? It is simple ...

  1. The developer creates a new extension class with ExtensionBase as a base class.
  2. Magic happens behind the scene (actually magic will happen in AspectSharp.targets and AspectSharp.Build.dll).
  3. The developer sees all the new properties/methods right to the extended class live in Visual Studio.

The magic

We are extending theMSBuild build process with our targets from AspectSharp.targets which will be applied right before compile. Our targets will find all extensions and then all extended classes. Based on the extensions new extended classes will be generated and included into the compiled files. Respectively original extended classes will be excluded from the compiled files. Therefore the generated extended classes will be included in the output assembly.

Visual Studio Design-Time build

Contributing

Anyone is welcome!

License

AspectSharp is distributed under theGPL-3.0 License.


[8]ページ先頭

©2009-2025 Movatter.jp