You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+97-1Lines changed: 97 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Project Overview
6
6
7
-
This is a **Roslyn C# Source Generators** project that provides compile-time code generation for .NET applications. The solution contains three main source generators:
7
+
This is a **Roslyn C# Source Generators** project that provides compile-time code generation for .NET applications. The solution contains four main source generators:
8
8
9
9
1.**DependencyRegistrationGenerator** - Automatically generates dependency injection service registrations
The `PetStore.Api` sample demonstrates all four generators working together in a realistic 3-layer ASP.NET Core application with OpenAPI/Scalar documentation.
Copy file name to clipboardExpand all lines: README.md
+112Lines changed: 112 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ A collection of Roslyn C# source generators for .NET that eliminate boilerplate
17
17
-**[⚙️ OptionsBindingGenerator](#️-optionsbindinggenerator)** - Automatic configuration binding to strongly-typed options classes
18
18
-**[🗺️ MappingGenerator](#️-mappinggenerator)** - Automatic object-to-object mapping with type safety
19
19
-**[🔄 EnumMappingGenerator](#-enummappinggenerator)** - Automatic enum-to-enum mapping with intelligent matching
20
+
-**[📋 AnnotationConstantsGenerator](#-annotationconstantsgenerator)** - Compile-time access to DataAnnotation metadata
20
21
21
22
## ✨ See It In Action
22
23
@@ -808,6 +809,108 @@ Get errors and warnings at compile time, not runtime:
808
809
809
810
---
810
811
812
+
### 📋 AnnotationConstantsGenerator
813
+
814
+
Access DataAnnotation attribute metadata at compile time without reflection. The generator automatically scans classes and records for `System.ComponentModel.DataAnnotations` attributes and generates strongly-typed constants.
815
+
816
+
#### 📚 Documentation
817
+
818
+
-**[Annotation Constants Guide](docs/AnnotationConstantsGenerator.md)** - Full documentation with examples
819
+
-**[Sample Projects](docs/AnnotationConstantsGenerator-Samples.md)** - Working code examples
820
+
821
+
#### 😫 From This
822
+
823
+
```csharp
824
+
// Runtime reflection to access annotation metadata 😫
Console app demonstrating compile-time access to DataAnnotation metadata without reflection. Shows how to access Display names, validation rules, and data type constraints via generated constants.
969
+
970
+
```bash
971
+
cd sample/Atc.SourceGenerators.AnnotationConstants
972
+
dotnet run
973
+
```
974
+
863
975
### 🎯 [PetStore API - Complete Example](docs/PetStoreApi-Samples.md)
864
976
865
977
Full-featured ASP.NET Core application using **all four generators** together with OpenAPI/Scalar documentation. This demonstrates production-ready patterns for modern .NET applications.
0 commit comments