Git Product home page Git Product logo

aspectdn's Introduction

AspectDN_Logo

AspectDN is a library used to weave advices directly on binary assemblies developed in .net. You have only to describe, with a language derived from C#5, the code or types you want to add or change in the target assembly or assemblies (dll or exe).

short description

With the help of AspectDN, you will be able to declare advices, pointcuts and aspects and weave several types of advices:
      - Chunk of code
      - Classes, structures, interfaces, enumerations and delegates
      - Members : fields, property, event, constructor

Pointcuts and jointoints can be according advice kinds:
      - Assemblies
      - Types
      - Fields
      - Properties
      - Methods
      - Exceptions
      - Events

Depending on the advice, the corresponding join point is applied:
      - before, after or around add, remove, get, set or call method
      - before, after or around a body method, property or event
      - before, after or around an triggered event
      - before an exception arises

example

Imagine that you have the following 'Set' method class within the class Target in which you want to trace exceptions.

using System;
namespace Test
{
	public class Target :  MarshalByRefObject
	{
		int _P1;
		public int P1
		{
			get;
			set;
		}
		public void Set(object x1, object x2)
		{
			P1 = (int)x1/(int)x2;
		}
	}
}

With AspectDN, you are able to solve your problem with the following aspect without changing your code.

using System;
using System.IO;
using System.Diagnostics;

package Aspects
{
	code => 
		extend around set properties : properties.Name == "P1" 
		with
		{
			var methodName = new StackFrame().GetMethod().ToString();
			using (StreamWriter sw = new StreamWriter(@"..\log.txt", true))
			{
				sw.WriteLine(string.Format("{0}: begin",methodName));
				try
				{
					[around anchor];
				}
				catch
				{
					sw.WriteLine(string.Format("{0}: catch",methodName));
				}
				finally
				{
					sw.WriteLine(string.Format("{0}: finally",methodName));
				}
				sw.WriteLine(string.Format("{0}: end",methodName));
			}
		}
}

Dont't hesitate to run the AspectDN Tutorials for more explanation on the use of AspectDN

Technologies

AspectDN needs several libraries are used and required to compile the project:
      - Cecil of Jb Evain (version 0.11.0)
      - Roslyn (CodeAnalysis.CSharp) (version 3.8.0)

AspectDN can only be used to target Microsoft .Net DLL and EXE file.

All tests have been done with Microsoft .NET Framework 4.6.1

Documentations

You can download the AspectDN Documentation

Installation

Download AspectDN and from its directory, run the command 'aspectd -window', load the aspectdn project configuration file and weave.

License

GNU GPLv3 with possible commercial licence including more functionalities. Please contact us for more informations ([email protected])

Change Log

Last Change : 2023/07/01

Contributors

Contributors are wellcome. All contributions are submitted to Contributor Assignment Agreemen (Individual or Corporate) Please contact us to get the agreement or for more information about it ([email protected])

aspectdn's People

Contributors

tfreyburger avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

atikhan

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.