From bb4b19af73eb5033628a05d793dd183ed5c70da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=81ukasik?= Date: Fri, 21 Jun 2024 22:34:33 +0200 Subject: [PATCH] 009: Wolverine source generation --- README.md | 3 ++- tip-009/README.md | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tip-009/README.md diff --git a/README.md b/README.md index 4a4753a..bd9bf5e 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,5 @@ List of the daily tips - [Day-005](./tip-005/README.md) - Wolverine registration rules - [Day-006](./tip-006/README.md) - Are we interface obsessed? - [Day-007](./tip-007/README.md) - MemberNotNullWhen -- [Day-008](./tip-008/README.md) - Log injection \ No newline at end of file +- [Day-008](./tip-008/README.md) - Log injection +- [Day-009](./tip-009/README.md) - Wolverine source generation \ No newline at end of file diff --git a/tip-009/README.md b/tip-009/README.md new file mode 100644 index 0000000..32ecc92 --- /dev/null +++ b/tip-009/README.md @@ -0,0 +1,13 @@ +# 009 - Wolverine source generation # + +Back to Wolverine topic. One of the interesting (or unique) feature is that Wolverine can work in a fashion that our bindings are source generated. If we are in the development mode that's not very beneficial as we would be generating based on a constantly changing code but once we are fairly done we can use the magic of source generation and get rid of reflection for resolving the handlers. Link to the docs: https://wolverine.netlify.app/guide/codegen.html + +The topic of source generating parts of the previously dynamic code is something we will see more and more often. + +```csharp +builder.Host.UseWolverine(options => +{ + // use Auto to generate/load generated types or Static in Production to load + options.CodeGeneration.TypeLoadMode = TypeLoadMode.Auto; +}); +``` \ No newline at end of file