Skip to content

Commit d2465cf

Browse files
committed
Reviewing the email course: work in progress.
1 parent 26255e5 commit d2465cf

18 files changed

+66
-59
lines changed

metalama-awareness-campaign/01_more_effective_way.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ It’s possible to preview or even debug the code generated by Metalama. The rea
6161
- **Real-time feedback and code modifications**
6262
- **Preview and debug generated code**
6363

64-
You can find the source code of this example, as well as more examples, on [GitHub](https://github.com/postsharp/Metalama.Demo/blob/master/src/01_Log/LogAttribute.cs?mtm_campaign=awareness&mtm_source=instantly). You can learn more about Metalama thanks to the [video tutorials](https://doc.postsharp.net/metalama/videos?mtm_campaign=awareness&mtm_source=instantly) and [commented examples](https://doc.postsharp.net/metalama/examples?mtm_campaign=awareness&mtm_source=instantly).
64+
You can find the source code of this example, as well as more examples, on [GitHub](https://github.com/postsharp/Metalama.Demo/blob/master/src/01_Log/LogAttribute.cs?mtm_campaign=awareness&mtm_source=instantly). You can learn more about Metalama thanks to the [video tutorials](https://doc.metalama.net/videos?mtm_campaign=awareness&mtm_source=instantly) and [commented examples](https://doc.metalama.net/examples?mtm_campaign=awareness&mtm_source=instantly).
6565

6666
Our development team is looking forward to your feedback and questions on our [Slack community workspace](https://www.postsharp.net/slack?mtm_campaign=awareness&mtm_source=instantly). Of course, you can also answer this email and I’ll make sure it will reach an engineer.
6767

metalama-awareness-campaign/02_naming_conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ LAMA0903. The type ‘MyInvoiceConverted’ does not respect the naming conventi
2424

2525
The shorter the feedback loop is, the smoother the code reviews will go! Not talking about the frustration both sides avoided!
2626

27-
You can learn more about code validation with Metalama in our [online documentation](https://doc.postsharp.net/metalama/examples?mtm_campaign=awareness&mtm_source=instantly).
27+
You can learn more about code validation with Metalama in our [online documentation](https://doc.metalama.net/examples?mtm_campaign=awareness&mtm_source=instantly).
2828

2929
As I wrote in my first email, our development team is looking forward to your feedback and questions on our [Slack community workspace](https://www.postsharp.net/slack?mtm_campaign=awareness&mtm_source=instantly). Of course, you can also answer this email and I’ll make sure it will reach an engineer.
3030

metalama-awareness-campaign/03_caching.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ You can add caching to your app in just three steps:
5252
builder.Services.AddMetalamaCaching();
5353
```
5454

55-
This will use the `MemoryCache` by default. If you want to [use Redis](https://doc.postsharp.net/metalama/preview/patterns/caching/redis), do this:
55+
This will use the `MemoryCache` by default. If you want to [use Redis](https://doc.metalama.net/preview/patterns/caching/redis), do this:
5656
5757
```c#
5858
builder.Services.AddMetalamaCaching( caching => caching.WithBackend( backend => backend.Redis() ) );
@@ -70,16 +70,16 @@ You can add caching to your app in just three steps:
7070

7171
At build time, Metalama transforms your code on-the-fly:
7272
* It pulls the dependency to `ICachingService`.
73-
* It generates the [cache key](https://doc.postsharp.net/metalama/preview/patterns/caching/caching-keys).
73+
* It generates the [cache key](https://doc.metalama.net/preview/patterns/caching/caching-keys).
7474
* It wraps your cached method into a delegate before calling `ICachingService.GetOrAdd`.
7575

7676
Other features of this open-source caching library include:
7777

7878
* Serialization.
79-
* Robust [invalidation](https://doc.postsharp.net/metalama/preview/patterns/caching/invalidation). Say goodbye to the cache key hell.
80-
* Multi-node [synchronization](https://doc.postsharp.net/metalama/preview/patterns/caching/pubsub) over Redis or Azure Service Bus.
79+
* Robust [invalidation](https://doc.metalama.net/preview/patterns/caching/invalidation). Say goodbye to the cache key hell.
80+
* Multi-node [synchronization](https://doc.metalama.net/preview/patterns/caching/pubsub) over Redis or Azure Service Bus.
8181
* Transparent handling of weird types like `IEnumerable` or `Stream`.
82-
* [Locking](https://doc.postsharp.net/metalama/preview/patterns/caching/locking).
82+
* [Locking](https://doc.metalama.net/preview/patterns/caching/locking).
8383
* Compatible with .NET Aspire.
8484

8585
## Conclusion

metalama-awareness-campaign/04_validating_architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ Enforcing rules and conventions in this manner allows you to:
8080
- Improve code reviews as they now only need to focus on the code itself.
8181
- Simplify the codebase because it adheres to consistent rules.
8282

83-
You can learn more about architecture validation in our online [documentation](https://doc.postsharp.net/metalama/conceptual/architecture/usage).
83+
You can learn more about architecture validation in our online [documentation](https://doc.metalama.net/conceptual/architecture/usage).

metalama-awareness-campaign/05_last.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Today, let's look into more advanced patterns in C# and explore how you can auto
88

99
If you're building a desktop or mobile app, or even a web app with client-side Blazor, you're likely familiar with the `INotifyPropertyChanged` interface. While it seems simple to implement, it can become cumbersome and error-prone as you add more complex properties and dependencies between objects.
1010

11-
Enter the `[Observable]` aspect from the open-source [Metalama.Patterns.Observability](https://doc.postsharp.net/metalama/patterns/observability?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) package.
11+
Enter the `[Observable]` aspect from the open-source [Metalama.Patterns.Observability](https://doc.metalama.net/patterns/observability?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) package.
1212

1313
```csharp
1414
[Observable]
@@ -37,11 +37,11 @@ This aspect handles `INotifyPropertyChanged` implementation for you, supporting
3737

3838
- **Properties depending on properties of the base type.**
3939

40-
Consider how much boilerplate code you'd need to properly implement `INotifyPropertyChanged` for these scenarios and how much you would save with Metalama! To see the work Metalama does for you, [check out the diff](https://doc.postsharp.net/metalama/patterns/observability/standard-cases?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly).
40+
Consider how much boilerplate code you'd need to properly implement `INotifyPropertyChanged` for these scenarios and how much you would save with Metalama! To see the work Metalama does for you, [check out the diff](https://doc.metalama.net/patterns/observability/standard-cases?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly).
4141

4242
It's not just about saving code, but also about enhancing code quality. Remember the last bug when you forgot to add a call to `OnPropertyChanged` for a computed property? With `[Observable]`, since dependency discovery is fully automatic, this won't happen any more.
4343

44-
Read more details about `[Observable]` in our [documentation](https://doc.postsharp.net/metalama/patterns/observability?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly).
44+
Read more details about `[Observable]` in our [documentation](https://doc.metalama.net/patterns/observability?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly).
4545
4646
## Builder Pattern
4747

@@ -93,22 +93,22 @@ public partial class Song
9393
}
9494
```
9595

96-
How repetitive! Do you really want to write this code by hand? Thankfully, [this can be automated using Metalama](https://doc.postsharp.net/metalama/examples/builder?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly), and you can tailor the code generation pattern to fit your needs.
96+
How repetitive! Do you really want to write this code by hand? Thankfully, [this can be automated using Metalama](https://doc.metalama.net/examples/builder?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly), and you can tailor the code generation pattern to fit your needs.
9797
9898
## Other Examples
9999

100100
We can't cover all use cases of Metalama in a single email, so before wrapping up this sequence, here's a list of Metalama use cases:
101101

102-
- [Parameter validation](https://doc.postsharp.net/metalama/examples/validation?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) and [code contracts](https://doc.postsharp.net/metalama/patterns/contracts);
103-
- [Logging](https://doc.postsharp.net/metalama/examples/log?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
104-
- [Exception handling](https://doc.postsharp.net/metalama/examples/exception-handling?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) with or without [Polly](https://doc.postsharp.net/metalama/examples/exception-handling/retry/retry-5);
105-
- [Caching](https://doc.postsharp.net/metalama/patterns/caching?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) and [memoization](https://doc.postsharp.net/metalama/patterns/memoization?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
106-
- [INotifyPropertyChanged](https://doc.postsharp.net/metalama/patterns/observability), WPF [commands](https://doc.postsharp.net/metalama/patterns/wpf/command?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly), and [dependency properties](https://doc.postsharp.net/metalama/patterns/wpf/dependency-property?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
107-
- [Architecture verification](https://doc.postsharp.net/metalama/conceptual/architecture?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
108-
- [Change tracking](https://doc.postsharp.net/metalama/examples/change-tracking?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) and the [Memento pattern](https://doc.postsharp.net/metalama/examples/memento?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly).
109-
- [Cloning](https://doc.postsharp.net/metalama/examples/clone?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
110-
- [Builder](https://doc.postsharp.net/metalama/examples/builde?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly), and [Singleton](https://doc.postsharp.net/metalama/examples/singleton?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) patterns;
111-
- [ToString](https://doc.postsharp.net/metalama/examples/tostring) generation.
102+
- [Parameter validation](https://doc.metalama.net/examples/validation?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) and [code contracts](https://doc.metalama.net/patterns/contracts);
103+
- [Logging](https://doc.metalama.net/examples/log?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
104+
- [Exception handling](https://doc.metalama.net/examples/exception-handling?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) with or without [Polly](https://doc.metalama.net/examples/exception-handling/retry/retry-5);
105+
- [Caching](https://doc.metalama.net/patterns/caching?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) and [memoization](https://doc.metalama.net/patterns/memoization?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
106+
- [INotifyPropertyChanged](https://doc.metalama.net/patterns/observability), WPF [commands](https://doc.metalama.net/patterns/wpf/command?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly), and [dependency properties](https://doc.metalama.net/patterns/wpf/dependency-property?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
107+
- [Architecture verification](https://doc.metalama.net/conceptual/architecture?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
108+
- [Change tracking](https://doc.metalama.net/examples/change-tracking?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) and the [Memento pattern](https://doc.metalama.net/examples/memento?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly).
109+
- [Cloning](https://doc.metalama.net/examples/clone?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly);
110+
- [Builder](https://doc.metalama.net/examples/builde?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly), and [Singleton](https://doc.metalama.net/examples/singleton?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly) patterns;
111+
- [ToString](https://doc.metalama.net/examples/tostring) generation.
112112
113113
For more use cases and open-source aspect implementations, visit the [Metalama Marketplace](https://www.postsharp.net/metalama/marketplace?mtm_campaign=awareness&mtm_kwd=email5&mtm_source=instantly).
114114

metalama-email-course/015-vsx.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Have You Installed Visual Tools for Metalama?
22

3-
If you are using Visual Studio 2022 (any edition), ensure that you have installed the [Visual Tools for Metalama and PostSharp](https://www.postsharp.net/links/download-unified-vsx). While not a prerequisite for using Metalama, this tool significantly simplifies the process by offering several useful features in the IDE.
3+
If you are using Visual Studio 2022 (any edition), ensure that you have installed the [Visual Tools for Metalama](https://marketplace.visualstudio.com/items?itemName=PostSharpTechnologies.PostSharp). While not a prerequisite for using Metalama, this tool significantly simplifies the process by offering several useful features in the IDE.
4+
5+
> [!NOTE]
6+
> Visual Tools for Metalama are not open source but are **FREE** for individuals, non-commercial use, and companies with up to 3 users under the Metalama Community license.
47
58
## Metalama Diff
69

@@ -54,4 +57,4 @@ Experienced Metalama users will appreciate both the syntax highlighting and the
5457

5558
## Summary
5659

57-
If you are using Visual Studio 2022, don't miss the [Visual Tools for Metalama and PostSharp](https://www.postsharp.net/links/download-unified-vsx). It offers plenty of features to make your work with Metalama easier.
60+
If you are using Visual Studio 2022, don't miss the [Visual Tools for Metalama](https://marketplace.visualstudio.com/items?itemName=PostSharpTechnologies.PostSharp). It offers plenty of features to make your work with Metalama easier.

metalama-email-course/030-caching.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can add caching to your app in just three steps:
1212

1313
1. Add the [Metalama.Patterns.Caching.Aspects](https://www.nuget.org/packages/Metalama.Patterns.Caching.Aspects/) package to your project.
1414
2. Navigate to all methods that need caching and add the `[Cache]` custom attribute.
15-
3. Go to the application startup code and call `AddCaching`, which adds the `ICachingService` interface to your `IServiceCollection`, enabling the `[Cache]` aspect to be used on all objects instantiated by the DI container. This code is rather standard and we omit it for brevity, but you can find it in the [documentation](https://doc.postsharp.net/metalama/patterns/caching/getting-started).
15+
3. Go to the application startup code and call `AddCaching`, which adds the `ICachingService` interface to your `IServiceCollection`, enabling the `[Cache]` aspect to be used on all objects instantiated by the DI container. This code is rather standard and we omit it for brevity, but you can find it in the [documentation](https://doc.metalama.net/patterns/caching/getting-started).
1616

1717
Let's examine what the `[Cache]` attribute does with your code. Consider the following example:
1818

@@ -147,16 +147,20 @@ using Metalama.Patterns.Caching.Aspects;
147147
[assembly: CachingConfiguration( UseDependencyInjection = false )]
148148
```
149149

150-
The Metalama [documentation](https://doc.postsharp.net/metalama/patterns/caching/getting-started) illustrates the same example as above, but without using Dependency Injection. As before, caching can be added via a single `[Cache]` attribute and it will produce the same result.
150+
The Metalama [documentation](https://doc.metalama.net/patterns/caching/getting-started) illustrates the same example as above, but without using Dependency Injection. As before, caching can be added via a single `[Cache]` attribute and it will produce the same result.
151151

152152
## Going Further with Caching
153153

154-
Metalama not only simplifies the implementation of caching but also provides means to customize your cache keys, exclude certain parameters, and invalidate a particular cache by merely adding an attribute. This principle even extends to configuring the caching itself via the `[CachingConfiguration()]` attribute.
154+
Metalama not only simplifies the implementation of caching but also provides means to customize your cache keys, exclude certain parameters, and invalidate a particular cache by merely adding an attribute. This principle even extends to configuring the caching itself via the `[CachingConfiguration]` attribute.
155155

156156
Applying caching to an application can dramatically improve performance, but implementing the pattern is not straightforward. Metalama does all the heavy lifting for you and provides several flexible implementations that you can customize to meet your specific requirements.
157157

158-
If you have a distributed application that could benefit from caching, Metalama has that [covered for you](https://doc.postsharp.net/metalama/patterns/caching/redis).
158+
## Distributed Caching
159+
160+
If you have a distributed application that could benefit from caching, Metalama has that [covered for you](https://doc.metalama.net/patterns/caching/redis).
161+
162+
Metalama also supports the synchronization of [local in-memory caches for multiple servers](https://doc.metalama.net/patterns/caching/pubsub), offering support for both the Azure service bus and Redis Pub/Sub.
163+
159164

160-
Metalama also supports the synchronization of [local in-memory caches for multiple servers](https://doc.postsharp.net/metalama/patterns/caching/pubsub), offering support for both the Azure service bus and Redis Pub/Sub.
161165

162166
By leveraging Metalama, you'll find that implementing caching is both simpler and more efficient than creating a bespoke solution.

metalama-email-course/020-naming-conventions.md renamed to metalama-email-course/052-naming-conventions.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Validating Naming Conventions
22

3-
In my previous email, I demonstrated how Metalama can generate boilerplate code on-the-fly during compilation, automating the task of implementing necessary but repetitive code. However, code generation is not the only functionality Metalama offers. In this email, I will explore Metalama's second pillar: its ability to validate source code against architectural rules, starting with naming conventions.
3+
In my previous emails, I demonstrated how Metalama can generate boilerplate code on-the-fly during compilation, automating the task of implementing necessary but repetitive code. However, code generation is not the only functionality Metalama offers. In this email, I will explore Metalama's second pillar: its ability to validate source code against architectural rules, starting with naming conventions.
4+
5+
46

57
## Why Care About Naming Conventions?
68

@@ -114,4 +116,4 @@ We can see our warning in action below.
114116

115117
## Summary
116118

117-
Although both examples were quite simple, they illustrate how Metalama can be used to help validate your codebase and enforce rules. More information about this topic can be found in the [Metalama Documentation](https://doc.postsharp.net/metalama/conceptual/architecture/naming-conventions).
119+
Although both examples were quite simple, they illustrate how Metalama can be used to help validate your codebase and enforce rules. More information about this topic can be found in the [Metalama Documentation](https://doc.metalama.net/conceptual/architecture/naming-conventions).

metalama-email-course/060-creating-aspects-intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,4 @@ private static void HelloFromMrBojangles()
134134

135135
While this is a simple example, it serves to illustrate that creating custom aspects should not be seen as a daunting task.
136136

137-
The Metalama Documentation provides comprehensive information on [creating custom aspects](https://doc.postsharp.net/metalama/conceptual/aspects).
137+
The Metalama Documentation provides comprehensive information on [creating custom aspects](https://doc.metalama.net/conceptual/aspects).

metalama-email-course/090-add-logging-with-fabric.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ If we desired to target a Type or a Namespace, we could accomplish it with eithe
5757

5858
Fabrics are not only beneficial for appending aspects to your code, but they can also be utilized to implement architectural rules in your codebase.
5959

60-
You can read more about Fabrics [here](https://doc.postsharp.net/metalama/conceptual/using/fabrics). It's one of Metalama's more advanced features, but understanding how it operates will enable you to perform tasks that might have previously seemed nearly unachievable.
60+
You can read more about Fabrics [here](https://doc.metalama.net/conceptual/using/fabrics). It's one of Metalama's more advanced features, but understanding how it operates will enable you to perform tasks that might have previously seemed nearly unachievable.
6161

0 commit comments

Comments
 (0)