All Projects → Virtuoze → Nconcern

Virtuoze / Nconcern

Licence: mit
NConcern .NET AOP Framework

Projects that are alternatives of or similar to Nconcern

Aspect Injector
AOP framework for .NET (c#, vb, etc)
Stars: ✭ 398 (+186.33%)
Mutual labels:  advice, aop, injection
Puresharp
Puresharp is a Framework that provides the essential APIs (AOP, IOC, etc...) to productively build high quality (.NET 4.5.2+ & .NET Core 2.1+) applications through reliability, scalability and performance without no compromise
Stars: ✭ 120 (-13.67%)
Mutual labels:  advice, aop, injection
CNeptune
CNeptune improve productivity & efficiency by urbanize .net module with meta-code to lay foundation for frameworks
Stars: ✭ 30 (-78.42%)
Mutual labels:  injection, aop
Mradvice
.NET aspect weaver (build task under NuGet package)
Stars: ✭ 236 (+69.78%)
Mutual labels:  advice, aop
Swifthook
A library to hook methods in Swift and Objective-C.
Stars: ✭ 93 (-33.09%)
Mutual labels:  runtime, aop
Light My Request
Fake HTTP injection library
Stars: ✭ 114 (-17.99%)
Mutual labels:  injection
Npm Module Checklist
Steps to check when starting, working and publishing a module to NPM
Stars: ✭ 125 (-10.07%)
Mutual labels:  advice
Jaop
jaop is a gradle plugin base on javassist&asm for android aop
Stars: ✭ 115 (-17.27%)
Mutual labels:  aop
Nuclei
Proactive IO & Runtime system
Stars: ✭ 113 (-18.71%)
Mutual labels:  runtime
React In Patterns
A free book that talks about design patterns/techniques used while developing with React.
Stars: ✭ 10,948 (+7776.26%)
Mutual labels:  injection
Injectcollection
A collection of injection via vc++ in ring3
Stars: ✭ 131 (-5.76%)
Mutual labels:  injection
Dotnetbook
.NET Platform Architecture book (English, Chinese, Russian)
Stars: ✭ 1,763 (+1168.35%)
Mutual labels:  runtime
Ibase4j
Spring,SpringBoot 2.0,SpringMVC,Mybatis,mybatis-plus,motan/dubbo分布式,Redis缓存,Shiro权限管理,Spring-Session单点登录,Quartz分布式集群调度,Restful服务,QQ/微信登录,App token登录,微信/支付宝支付;日期转换、数据类型转换、序列化、汉字转拼音、身份证号码验证、数字转人民币、发送短信、发送邮件、加密解密、图片处理、excel导入导出、FTP/SFTP/fastDFS上传下载、二维码、XML读写、高精度计算、系统配置工具类等等。
Stars: ✭ 1,548 (+1013.67%)
Mutual labels:  aop
Runtypes
Runtime validation for static types
Stars: ✭ 1,950 (+1302.88%)
Mutual labels:  runtime
Framework
💎 Go! AOP PHP - modern aspect-oriented framework for the new level of software development
Stars: ✭ 1,559 (+1021.58%)
Mutual labels:  aop
React Ioc
Hierarchical Dependency Injection with new React 16 Context API
Stars: ✭ 133 (-4.32%)
Mutual labels:  injection
Cscore
cscore is a minimal-footprint library providing commonly used helpers & patterns for your C# projects. It can be used in both pure C# and Unity projects.
Stars: ✭ 115 (-17.27%)
Mutual labels:  injection
Injector
Library for injecting a shared library into a Linux or Windows process
Stars: ✭ 131 (-5.76%)
Mutual labels:  injection
Phd
A list of resources on how/why to do a PhD
Stars: ✭ 120 (-13.67%)
Mutual labels:  advice
Gamemaniptutorial
A tutorial for manipulating the rendering of a game (generally to increase its quality) if you only have a binary available
Stars: ✭ 119 (-14.39%)
Mutual labels:  injection

Important : Issues has been disabled because NConcern has been redesigned, improved and made reliable through the Puresharp project.

NuGet

NConcern .NET AOP Framework

NConcern is a .NET runtime AOP (Aspect-Oriented Programming) lightweight framework written in C# that reduces tangling caused by cross-cutting concerns. Its role is to introduce Aspect-Oriented Programming paradigm with a minimum cost to maximize quality and productivity.

Features

NConcern AOP Framework is based on code injection at runtime.

  • non-intrusive : no need to adapt source code.
  • friendly : delegates, expressions (linq) or CIL (ILGenerator) can be used to define an aspect
  • no configuration : additional configuration files are not required
  • no proxy : decoration by inheritance and factory pattern are not required
  • low learning curve : get started under 20 minutes
  • no installer : a nuget to install for aspects definition and another to make assembly injectable.
  • suited for unit testing : weaving is controlled at runtime
  • low performance overhead : injection mechanic is built to be efficient
  • limitless : all kind of methods (constructors included) are supported
  • runtime lifecycle : aspect can be updated/created/removed at runtime

Aspect

An aspect represents a set of features related to a specific concern. The role of an aspect is to provide advices for method. It can be added and removed at runtime.

Advice

An advice is the code added by an aspect to complete a method. It can be implemented using delegate, expression or CIL generation.

  • Before : runs before method execution
  • After : runs after method execution regardless of its outcome
  • After.Returning : runs after method execution only if it completes sucessfully
  • After.Throwing : runs after method execution only if it exits by throwing an exception
  • Around : runs around method execution

Example

  • Use case :
I want to trace my service calls with "Console.WriteLine".
My services are OperationContract typed (WCF service)
  • Calculator : WCF service
[ServiceContract]
public class Calculator
{
    [OperationContract]
    public int Add(int a, int b)
    {
       return a + b;
    }
}
PM> Install-Package CNeptune
  • Tracer : simple tracer to log into Console
static public class Tracer
{
    static public void Trace(MethodBase method, object[] arguments)
    {
        Console.WriteLine("{0}({1})", method.Name, string.Join(", ", arguments));
    }
}
PM> Install-Package NConcern
  • Logging (Aspect) : define how "Tracer" can be injected into a method
public class Logging : IAspect
{
    public IEnumerable<IAdvice> Advise(MethodBase method)
    {
        yield return Advice.Basic.Before((instance, arguments) => 
        {
            Tracer.Trace(method, arguments);
        });
    }
}
  • Enable logging for services using implicit joinpoint
Aspect.Weave<Logging>(typeof(OperationContractAttribute));
  • Disable logging for services using implicit joinpoint
Aspect.Release<Logging>(typeof(OperationContractAttribute));

FAQ

  • How this AOP Framework is different from the others? Most of time developping cross-cutting source code required reflection and boxing to be done. NConcern offer a way to define it using Linq Expressions or ILGenerator because cross-cutting source code have to manage not statically known datas. No need factory and no need base class is the second exclusive feature that make the difference because interception is not based on method overriding, MarshalByRef nor ContextBoundObject.

  • How fast is "low performance overhead"? There is no perceptible overhead when Linq Expressions or ILGenerator are used. Basic advice introduce a light overhead caused by boxing and arguments array creation. However, MethodInfo is not prepared if capture is not required in lambda expression.

  • Why I have to use CNeptune? _Interception is based on CNeptune. Indeed CNeptune add a build action to rewrite CIL to make assembly "Architect Friendly" by injecting transparents and hidden features to to grant full execution control at runtime.

  • Can I add multiple aspect for same target? If yes how can I control priority? Yes you can. Priority is defined by the order of weaving. It can be reorganized by calling Aspect.Release(...)/Aspect.Weave(...) and you can check the whole aspects mapping by calling Aspect.Lookup(...).

  • Is an attribute required to identify a mehod to weave? No you can identify a method by the way you want. There is a Aspect.Weave(...) overload that take a Func<MethodInfo, bool> to select methods.

  • Can I intercept constructor? If yes, how do I implement it? Constructor interception is supported and is treated like another method with declaring type as first argument and void for return type.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].