Briefs

You can subscribe for Metalama's briefs with RSS.

05/12/2025 · Brief
We're now publishing brief updates.

As we are closing our Slack workspace, we will publish briefs (typically announcing builds) on this website instead. We’ll keep briefs separate from long-form articles published on our blog. You can subscribe to briefs using RSS or JSON Feed from this page.

12/18/2024 · Blog Post
Hi-Res Logging in .NET Aspire Without Touching Business Code
This article will explore how to trace method calls in a .NET Aspire app without boilerplate code using Metalama. It uses a base example of a to-do list app with an ASP.NET Core Minimal API backend and a Blazor front-end, orchestrated using .NET Aspire. During the article, we’ll demonstrate how to log all public methods of the app using the [Log] aspect with a special kind of class called a fabric. The article will also show how to analyze the logs using the .NET Aspire dashboard.
Read Article
11/04/2024 · Blog Post
Implement ICommand with Metalama
This article explores the use of the ICommand interface in a temperature monitor application, contrasting manual and automated approaches using Metalama. Initially, it details how to manually create commands for operating a temperature sensor, highlighting the repetitive coding and potential for errors. Then, it introduces Metalama and its [Command] aspect to automatically generates the necessary boilerplate code for ICommand implementations. The comparison reveals that Metalama minimizes manual effort and errors, enhancing development efficiency.
Read Article
10/31/2024 · Blog Post
Metalama Status Update, October 2024
As the .NET Conf 2024 approaches, we’ve made significant progress in supporting .NET 9.0 and C# 13 with both Metalama and PostSharp. But that’s not all. We’ve also filled usability gaps in introduced types and added several minor features. October was buzzing with community interactions: we hosted an event with Andrea Angella from Productive C#, exchanged blog posts with GoatReview, and published five articles on our own.
Read Article
10/14/2024 · Blog Post
Implement INotifyPropertyChanged with Metalama
Most of today’s UI applications rely on binding data classes to UI classes. The INotifyPropertyChanged interface is the standard way to achieve this. However, implementing this interface manually can be cumbersome and error-prone, particularly when dealing with a large number of properties. In this article, we’ll show you how to use Metalama to implement the INotifyPropertyChanged interface with minimal manual effort. We’ll approach this in two ways: first, by providing a basic, educational implementation of an aspect using Metalama; and second, by using our open-source, production-ready implementation of the Observable pattern. Not only will we eliminate virtually all observability boilerplate from our codebase, but we will also reduce a significant source of human errors.
Read Article
10/07/2024 · Blog Post
Implementing the Builder pattern with Metalama
The popularity of immutable objects has made the Builder pattern one of the most important in C#. However, implementing the Builder pattern by hand is a tedious and repetitive task. Fortunately, because it is repetitive, it can be automated using a Metalama aspect. This is what we will explore in this article. We will start discussing the implementation strategy, then we will comment the source code of the Metalama aspect.
Read Article
07/29/2024 · Blog Post
Metalama 2024.2 Generally Available: Class Introductions, Observability, and Much More
Metalama 2024.2 is now Generally Available. It is the first release to allow the automatic implementation of any code pattern. Its most-wanted features: you can now generate new classes and override or introduce constructors. This release also adds a robust ready-made implementation of INotifyPropertyChanged through the Metalama.Patterns.Observability package, supporting complex expressions and child objects. The Metalama.Patterns.Wpf package automatically implements dependency properties and commands. To enable these new features, we’ve made dozens of improvements across various aspects.
Read Article
07/08/2024 · Blog Post
Simplify Your .NET Aspire Caching With Metalama
As you may already know, .NET Aspire makes it very easy to build distributed cloud-native applications. It manages all the wiring between the different services of your application and other components like databases, messaging, and caching. One of the services you can use with .NET Aspire straight out of the box is Redis, a great solution for distributed caching. There are many points in your app where you can add caching (and one of the ways is to use Polly). In this article, we will see how to cache method results without boilerplate code thanks to a special kind of custom attribute called aspect. We’ll see how Metalama can generate the caching boilerplate code for you based on this custom attribute.
Read Article