Giter VIP home page Giter VIP logo

nadvisor's Introduction

#######################################################################################################################
NAdivsor
#######################################################################################################################

NAdvisor is a small library which adds Aspects during runtime.

If you are looking for traditional Aspects have a look at postsharp.org

The differences compared to traditional Aspects are:
- Aspects can be instantiated, therefor can have dependencies in the constructor (fits very well with DI)
- Pointcuts/Join Points can be changed during runtime 
- Aspects can have a different lifetime than theire intercepted classes. 

Some things which are difficult to do with compile time weaved Aspects but are trivial with NAdvisor:
- unit testing with or without aspects
- unit testing of your logic inside the aspects
- JointPoints can be determined during runtime
- because aspects are normal objects, they can be instantiated, they can have dependencies. 
- using Mocked aspects during unit tests
- swap JointPoint definition during runtime (e.g. switching on/off performance measuring aspect)
- no impact on build time
- readable stacktraces

Usage:
//Instantiate a new SecurityAspect
IAspect securityAspect = new SecurityAspect(user);

//Creates a Proxy, chooses the Aspect from the List by the JointPointDefinition
Advisor advisor = new Advisor(JointPointDefinition.AttributeBasedJointPointDefinition, new List<IAspect>() {securityAspect, loggingAspect});

//Gets a Proxy which is intercepted by the Securityaspect and Loggingaspect
ISimpleService myService = advisor.GetAdvicedProxy<ISimpleService>(new SimpleService());



nadvisor's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

nadvisor's Issues

AutoFac Integration

Make something like this possible:

var container = new Autofac.Builder.ContainerBuilder();
container.Register(c => new Service()).As().AdviceJointPoints(MyJointPointDefinition);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.