Hi, everyone. After Unity 2.0 (http://unity.codeplex.com/) was released, I wondered on AOP (http://en.wikipedia.org/wiki/Aspect-oriented_programming) capabilities of this framework. In this post, I would like to show them on the example of cross-cutting security functionality injection.
For example, we have a set of repositories (http://martinfowler.com/eaaCatalog/repository.html) responsible for domain objects access. This domain objects can be stored in the different types of storages: Employees (in Active Directory), Orders (in external ERP), Devices (in locally stored XML file), etc. So, every repository has absolutely different underlying storage with which it works and it is difficult to control user permission based on every type of underlying storage. We also have requirements that only users with the ‘Admin’ role can perform create/edit/delete operations for domain objects and any user can read these objects in our application.