So that’s it – version 1.0 of AspectMap is on NuGet! This post will very quickly talk about the features available to you in this release, and my ideas for future versions.

What It Is

AspectMap is an Aspect Oriented framework built on top of the StructureMap IoC framework. It allows you to control your cross-cutting concerns centrally, and assign these to methods or classes by marking them with attributes.

Features

  • Aspects are wired up in your StructureMap repository, using an easy, fluent syntax;
  • Custom code will inherit from the AttributeHandler class, which gives access to the calling method and the attribute which launched the call;
  • Aspects can be nested, and the setup syntax allows central control over execution order;
  • Aspects can be assigned to individual methods, or entire classes;

Where to Get It

You can grab it now from NuGet by searching for AspectMap or clicking here.

How to Use It

Upgrading From Version 0.5

Apologies to those of you who downloaded the 0.5 release – I’ve had to make a breaking change for version 1. If you upgrade your NuGet package you will get a compile-time exception on each of your handler classes. This can be fixed in two quick steps:

Firstly inherit your class from the AttributeHandler abstract class rather than the IAttributeHandler interface.

Now change your Surround method declaration to:

public override Action<IInvocation> Surround(Action<IInvocation> invocation,
                   Attribute sourceAttribute)

This overrides the method in the abstract class, and allows you access to the attribute causing the handler to be called. By using an abstract class I can ensure that in future I can add features without changing the Surround method, to avoid more breaking changes.

What Next?

In the coming weeks I hope to firstly concentrate on the how to series of posts, which will also introduce a number of standard aspects you can use ‘out of the box’. After that I’d like to implement some form of caching system to ensure everything runs as fast as possible. All the source code will be on github in the next few days as well, so if you’d like to be involved then that’s brilliant!

Feedback

This project is currently solving the problems I needed solving, but I’d love it to be as useful as possible to you all. It’d be great to hear from you if you have any suggestions, or just stories about what you’ve used it for, it will definitely shape the future of AspectMap, get in touch!