Skip to content

Commit edf34dd

Browse files
committed
chore(release): 1.0.2
1 parent 922926b commit edf34dd

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
All notable changes to this project will be documented in this file. See [versionize](https://github.com/versionize/versionize) for commit guidelines.
44

5+
<a name="1.0.2"></a>
6+
## [1.0.2](https://www.github.com/mrdevrobot/ProjectR/releases/tag/v1.0.2) (2026-01-30)
7+
58
<a name="1.0.1"></a>
69
## [1.0.1](https://www.github.com/lucafabbri/ProjectR/releases/tag/v1.0.1) (2026-01-12)
710

ProjectR.Generator/ProjectR.Generator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
1010
<DevelopmentDependency>true</DevelopmentDependency>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
12-
<Version>1.0.1</Version>
12+
<Version>1.0.2</Version>
1313
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1414
</PropertyGroup>
1515

ProjectR/ProjectR.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<IsPackable>true</IsPackable>
66
<PackageId>ProjectR</PackageId>
77
<PackageReadmeFile>README.md</PackageReadmeFile>
8-
<Version>1.0.1</Version>
8+
<Version>1.0.2</Version>
99
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1010
</PropertyGroup>
1111

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ In modern applications following Clean or Onion Architecture, mapping objects be
2626

2727
* **Custom Mapping Policies**: A powerful fluent API (`ConfigureMappingPolicies`) lets you override the default behavior for creating objects and mapping individual properties and constructor parameters.
2828

29-
* **Dependency Injection Integration**: Provides `AddMappers()` and `IMapperResolver` for easy registration and resolution of mappers in your application's DI container.
29+
* **Dependency Injection Integration**: Provides `AddGeneratedMappers()` for high-performance, reflection-free registration of mappers.
30+
31+
* **Cross-Assembly Discovery**: Easily register mappers across multiple projects using the `[assembly: DiscoverMappers]` attribute.
3032

3133
* **Nested & Collection Mapping**: Automatically discovers and uses other mappers for complex, nested objects and collections.
3234

@@ -48,7 +50,9 @@ The core of ProjectR is a Roslyn Source Generator that activates during compilat
4850

4951
* If it finds a static method named `ConfigureMappingPolicies(IPolicyConfiguration config)`, it parses the user-defined rules and applies them to override the default behavior.
5052

51-
4. **Code Generation**: It generates a `partial class` implementation in a `.g.cs` file containing the `ProjectGenerated` and `BuildGenerated` methods. The public `Project` and `Build` methods in your base class then call these generated implementations. This generated code is compiled along with the rest of your project.
53+
4. **Code Generation**: It generates:
54+
* A `partial class` implementation in a `.g.cs` file containing the `ProjectGenerated` and `BuildGenerated` methods.
55+
* A `GeneratedMapperRegistrations` class containing an `AddGeneratedMappers()` extension method for `IServiceCollection`. This method registers all mappers in the assembly directly into the DI container without using reflection.
5256

5357
## 🚀 Getting Started: Example
5458

@@ -134,26 +138,29 @@ public partial class CreateProductDtoMapper
134138

135139
### 3. Configure Dependency Injection
136140

137-
In your `Program.cs`, use the `AddMappers` extension method to scan your assemblies and register all found mappers.
141+
In your `Program.cs`, call `AddGeneratedMappers()` to register all mappers. To discover mappers from referenced assemblies, add the `[assembly: DiscoverMappers]` attribute to your assembly.
138142

139143
```csharp
140144
// Program.cs
141-
using ProjectR.Hosting;
142-
using YourApp.Application.DTOs; // The assembly containing your DTOs
145+
using ProjectR.Generated; // The namespace where registrations are generated
146+
147+
[assembly: DiscoverMappers] // Enable discovery of mappers in referenced projects
143148
144149
var builder = WebApplication.CreateBuilder(args);
145150

146151
// ... other services
147152
148-
// Scan the specified assembly for mappers and register them and the resolver.
149-
builder.Services.AddMappers(typeof(CreateProductDto).Assembly);
153+
// High-performance registration generated at compile-time.
154+
builder.Services.AddGeneratedMappers();
150155

151156
var app = builder.Build();
152157

153158
// ...
154-
155159
```
156160

161+
> [!NOTE]
162+
> The old reflection-based `AddMappers()` is now deprecated and should be replaced with `AddGeneratedMappers()`.
163+
157164
### 4. Use the Mapper in Your Services
158165

159166
Inject `IMapperResolver` into your services to get mapper instances at runtime.

0 commit comments

Comments
 (0)