Aspect-oriented programming with C# and .NET

Wolfgang Schult, Andreas Polze · 2003

Microsoft has introduced the .NET architecture as a new component-based programming environment, which allows for easy integration of classical distributed programming techniques with Web computing. NET defines a type system and introduces notions such as component, object, and interface, which are building blocks for distributed multi-language component-based applications. As many other component frameworks, .NET mainly focuses on functional interfaces of components. Non-functional aspects of components, such as resource usage (CPU, memory), timing behavior, fault-tolerance, or security requirements are currently not expressed in .NET's component interfaces. We discuss the usage of aspect-oriented programming techniques in context of the .NET framework. We focus on the fault-tolerance aspect and discuss the expression of non-functional component properties (aspects) as C# custom attributes. Our approach uses reflection to generate replicated objects based on settings of a special "fault-tolerance" attribute for C# components. We have implemented an aspect-weaver for integration of aspect-code and component-code, which uses the mechanisms of the language-neutral .NET type system. Therefore, our approach is not restricted to the C# language but works for any of the .NET programming languages.

Read the paper · More papers on PaperTik