Open sandboxFocusImprove this doc

Using Metalama

This chapter is designed for individuals seeking to understand how to use aspects without the necessity to create new ones. If your goal aligns with this, you may stop reading after this chapter. However, should you aim to create aspects, beginning with this chapter remains advantageous as it introduces the core principles and techniques.

By the end of this guide, you should feel confident in using aspects within your codebase.

Who should read this chapter?

This chapter is recommended for those who:

  • Have recently joined a team that is already utilizing Metalama.
  • Plan to use ready-made aspects but do not intend to create their own.
  • Intend to create their own aspects in the future, but prefer to take a gradual approach.

In this chapter

Article Description
Getting aspects This article outlines where to obtain aspects and provides a list of sample aspects used for demonstrations throughout this guide.
Adding aspects to your code This article details the process of applying an aspect to a target either manually by adding attributes or through the refactoring menu.
Understanding your aspect-oriented code This article explains how to utilize Code Lens and Code Diff to better understand your code.
Debugging aspect-oriented code This article provides guidance on how to debug transformed code using Visual Studio.
Using live templates Live templates are unique types of aspects that modify your source code directly in the editor. This article guides you on how to use them.
Adding many aspects simultaneously Manually adding aspects or using the refactoring menu may not always be feasible or practical. Sometimes, a programmatic method is required to apply aspects to different targets. This article demonstrates how to use Fabrics programmatically to add aspects to various targets.