Metalama and PostSharp for Visual StudioThis extension provides a unified UI for Metalama and PostSharp, the two compiler-level toolkits from PostSharp Technologies. Both toolkits let you define a pattern once and have the compiler implement and enforce it across your codebase, so the repetitive code never lands in your source files. Both are updated for each new version of .NET, C#, and Visual Studio. Which One Do I Use?
Every PostSharp subscription is a dual license: PostSharp and Metalama Professional, one seat, one renewal. What You Can Do
How Metalama Works1. Add a Package to Your ProjectAdd the 2. Write an Aspect Class, or Use a Ready-Made OneAspects are meta-classes that transform code using plain C# templates. They can also report warnings and errors, or suggest code fixes. Here is an aspect that adds logging to a method:
This is the simplest possible example. Ready-made aspects are available on the Metalama Marketplace to use as they are or to adapt. 3a. Apply Aspects One at a TimeYou can apply an aspect individually using a custom attribute.
3b. Apply Aspects in BulkOr you can apply aspects in bulk using compile-time, LINQ-like code.
4. BuildAt compile time, Metalama merges the aspect template with your business code. Your source files are left untouched.
What Features Does This Extension Add?Metalama and PostSharp are distributed as NuGet packages and do not require an IDE extension. This extension adds the following to Visual Studio: Metalama DiffCompare your source code with the generated code.
CodeLensSee at a glance when an aspect is affecting your code.
Aspect ExplorerBrowse the aspects available in the current solution and see their effect on your code.
T# Syntax HighlightingT# is Metalama's C#-to-C# template language. It is 100% C#-compatible; the syntax highlighting distinguishes code that runs at compile time from code that runs at run time.
PostSharp Debugging HelperA debugging helper for PostSharp-based projects. What Else Can Metalama Do?Validate ArchitectureExpress your architecture in code and have it enforced in real time, in the editor. In this example, the internals of the current namespace may not be accessed from a different namespace, except by tests.
Report Errors and Warnings from AspectsAny aspect can report an error or a warning when it detects a violation.
Suggest Code FixesAspects can attach code fix suggestions to errors and warnings, and offer refactorings.
Use Generated Code From Source CodeCode generated by an aspect is visible to IntelliSense and can be referenced from your own source code.
Leave Whenever You WantThe
Test Your AspectsMetalama includes a testing framework, so you can test your aspects before distributing them to your team.
|













