Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 30 additions & 107 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🎯 Atc Source Generators

A collection of Roslyn C# source generators for .NET that eliminate boilerplate code and improve developer productivity.
A collection of Roslyn C# source generators for .NET that eliminate boilerplate code and improve developer productivity. All generators are designed with **Native AOT compatibility** in focus, enabling faster startup times, smaller deployment sizes, and optimal performance for modern cloud-native applications.

## 🚀 Source Generators

Expand All @@ -9,6 +9,34 @@ A collection of Roslyn C# source generators for .NET that eliminate boilerplate
- **[🗺️ MappingGenerator](#️-mappinggenerator)** - Automatic object-to-object mapping with type safety
- **[🔄 EnumMappingGenerator](#-enummappinggenerator)** - Automatic enum-to-enum mapping with intelligent matching

## 📦 Installation

All generators are distributed in a single NuGet package. Install once to use all features.

**Required:**
```bash
dotnet add package Atc.SourceGenerators
```

**Optional (recommended for better IntelliSense):**
```bash
dotnet add package Atc.SourceGenerators.Annotations
```

Or in your `.csproj`:

```xml
<ItemGroup>
<!-- Required: Source generator -->
<PackageReference Include="Atc.SourceGenerators" Version="1.0.0" />

<!-- Optional: Attribute definitions with XML documentation -->
<PackageReference Include="Atc.SourceGenerators.Annotations" Version="1.0.0" />
</ItemGroup>
```

**Note:** The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense. If you include it, suppress the expected CS0436 warning: `<NoWarn>$(NoWarn);CS0436</NoWarn>`

---

### ⚡ DependencyRegistrationGenerator
Expand Down Expand Up @@ -93,34 +121,6 @@ public class EmailService : IEmailService, INotificationService { }
public class ReportService : IReportService { }
```

#### 📦 Installation

**Required:**
```bash
dotnet add package Atc.SourceGenerators
```

**Optional (recommended for better IntelliSense):**
```bash
dotnet add package Atc.SourceGenerators.Annotations
```

Or in your `.csproj`:

```xml
<ItemGroup>
<!-- Required: Source generator -->
<PackageReference Include="Atc.SourceGenerators" Version="1.0.0" />

<!-- Optional: Attribute definitions with XML documentation -->
<PackageReference Include="Atc.SourceGenerators.Annotations" Version="1.0.0" />
</ItemGroup>
```

**Note:** The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense. If you include it, suppress the expected CS0436 warning: `<NoWarn>$(NoWarn);CS0436</NoWarn>`

See the [complete guide](docs/generators/DependencyRegistration.md) for multi-project setups.

#### 🔧 Service Lifetimes

```csharp
Expand Down Expand Up @@ -277,32 +277,6 @@ public class MyService
}
```

#### 📦 Installation

**Required:**
```bash
dotnet add package Atc.SourceGenerators
```

**Optional (recommended for better IntelliSense):**
```bash
dotnet add package Atc.SourceGenerators.Annotations
```

Or in your `.csproj`:

```xml
<ItemGroup>
<!-- Required: Source generator -->
<PackageReference Include="Atc.SourceGenerators" Version="1.0.0" />

<!-- Optional: Attribute definitions with XML documentation -->
<PackageReference Include="Atc.SourceGenerators.Annotations" Version="1.0.0" />
</ItemGroup>
```

**Note:** The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense. If you include it, suppress the expected CS0436 warning: `<NoWarn>$(NoWarn);CS0436</NoWarn>`

#### 🛡️ Compile-Time Safety

| ID | Description |
Expand Down Expand Up @@ -399,6 +373,7 @@ var dtos = users.Select(u => u.MapToUserDto()).ToList();
- **🪆 Nested Object Mapping**: Automatically chains mappings for nested properties
- **🔁 Multi-Layer Support**: Build Entity → Domain → DTO mapping chains effortlessly
- **⚡ Zero Runtime Cost**: All code generated at compile time
- **🚀 Native AOT Compatible**: No reflection or runtime code generation - fully trimming-safe
- **🛡️ Type-Safe**: Compile-time validation catches mapping errors before runtime
- **📦 Null Safety**: Built-in null checking for nullable reference types
- **🎯 Convention-Based**: Maps properties by name - no configuration needed
Expand Down Expand Up @@ -460,32 +435,6 @@ var dto = person.MapToPersonDto();
// ✨ Null safety built-in
```

#### 📦 Installation

**Required:**
```bash
dotnet add package Atc.SourceGenerators
```

**Optional (recommended for better IntelliSense):**
```bash
dotnet add package Atc.SourceGenerators.Annotations
```

Or in your `.csproj`:

```xml
<ItemGroup>
<!-- Required: Source generator -->
<PackageReference Include="Atc.SourceGenerators" Version="1.0.0" />

<!-- Optional: Attribute definitions with XML documentation -->
<PackageReference Include="Atc.SourceGenerators.Annotations" Version="1.0.0" />
</ItemGroup>
```

**Note:** The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense. If you include it, suppress the expected CS0436 warning: `<NoWarn>$(NoWarn);CS0436</NoWarn>`

#### 🔁 Multi-Layer Architecture

Perfect for 3-layer architectures:
Expand Down Expand Up @@ -659,32 +608,6 @@ var dto = entity.MapToStatusDto(); // StatusDto.Unknown
var back = dto.MapToStatusEntity(); // StatusEntity.None (bidirectional!)
```

#### 📦 Installation

**Required:**
```bash
dotnet add package Atc.SourceGenerators
```

**Optional (recommended for better IntelliSense):**
```bash
dotnet add package Atc.SourceGenerators.Annotations
```

Or in your `.csproj`:

```xml
<ItemGroup>
<!-- Required: Source generator -->
<PackageReference Include="Atc.SourceGenerators" Version="1.0.0" />

<!-- Optional: Attribute definitions with XML documentation -->
<PackageReference Include="Atc.SourceGenerators.Annotations" Version="1.0.0" />
</ItemGroup>
```

**Note:** The generator emits fallback attributes automatically, so the Annotations package is optional. However, it provides better XML documentation and IntelliSense. If you include it, suppress the expected CS0436 warning: `<NoWarn>$(NoWarn);CS0436</NoWarn>`

#### 🛡️ Compile-Time Safety

Get errors and warnings at compile time, not runtime:
Expand Down