Skip to content

Commit 61a7d29

Browse files
committed
- checkin refactoring
1 parent d3198db commit 61a7d29

8 files changed

Lines changed: 725 additions & 204 deletions

File tree

README.md

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <img src="https://github.com/CodeShayk/TurboMapper/blob/master/Images/ninja-icon-16.png" alt="ninja" style="width:30px;"/> TurboMapper v1.0.0
1+
# <img src="https://github.com/CodeShayk/TurboMapper/blob/master/Images/ninja-icon-16.png" alt="ninja" style="width:30px;"/> TurboMapper v1.2.0
22
[![NuGet version](https://badge.fury.io/nu/TurboMapper.svg)](https://badge.fury.io/nu/TurboMapper) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/CodeShayk/TurboMapper/blob/master/LICENSE.md)
33
[![GitHub Release](https://img.shields.io/github/v/release/CodeShayk/TurboMapper?logo=github&sort=semver)](https://github.com/CodeShayk/TurboMapper/releases/latest)
44
[![master-build](https://github.com/CodeShayk/TurboMapper/actions/workflows/Master-Build.yml/badge.svg)](https://github.com/CodeShayk/TurboMapper/actions/workflows/Master-Build.yml)
@@ -10,29 +10,85 @@
1010
## Introduction
1111
### What is TurboMapper?
1212
`TurboMapper` is a lightweight, high-performance object mapper for .NET that provides both shallow and deep mapping capabilities. It serves as a free alternative to AutoMapper with a simple, intuitive API.
13-
## Getting Started?
13+
14+
## Getting Started
1415
### i. Installation
1516
Install the latest version of TurboMapper nuget package with command below.
1617

1718
```
1819
NuGet\Install-Package TurboMapper
1920
```
20-
### ii. Developer Guide
21+
22+
### ii. Quick Start Example
23+
```csharp
24+
using TurboMapper;
25+
using Microsoft.Extensions.DependencyInjection;
26+
27+
// Setup
28+
var services = new ServiceCollection();
29+
services.AddTurboMapper();
30+
var serviceProvider = services.BuildServiceProvider();
31+
var mapper = serviceProvider.GetService<IMapper>();
32+
33+
// Define models
34+
public class Source
35+
{
36+
public string Name { get; set; }
37+
public int Age { get; set; }
38+
}
39+
40+
public class Target
41+
{
42+
public string Name { get; set; }
43+
public int Age { get; set; }
44+
}
45+
46+
// Map single object
47+
var source = new Source { Name = "John Doe", Age = 30 };
48+
var target = mapper.Map<Source, Target>(source);
49+
50+
// Map collections
51+
var sources = new List<Source>
52+
{
53+
new Source { Name = "Alice", Age = 25 },
54+
new Source { Name = "Bob", Age = 32 }
55+
};
56+
57+
// Map to IEnumerable<T>
58+
IEnumerable<Target> targets = mapper.Map<Source, Target>(sources);
59+
60+
// Convert to list if needed
61+
List<Target> targetList = targets.ToList();
62+
```
63+
64+
### iii. Developer Guide
2165
This comprehensive guide provides detailed information on TurboMapper, covering everything from basic concepts to advanced implementations and troubleshooting guidelines.
2266

2367
Please click on [Developer Guide](https://github.com/CodeShayk/TurboMapper/wiki) for complete details.
2468

2569
## Release Roadmap
26-
This section provides the summary of planned releases with key details about each release.
70+
This section provides the summary of planned releases with key details about each release.
2771

2872
| Release Version | Release Date | Key Features | Backward Compatibility | Primary Focus |
2973
|----------------|--------------|--------------|----------------------|---------------|
30-
| 1.2.0 | October 2025 | Performance improvements (2x+ speed), collection mapping, custom type converters, conditional mapping, transformation functions, configuration validation, improved error messages | ✅ Fully backward compatible | Core improvements, mapping features, custom conversions |
74+
| 1.2.0 | October 2025 | Performance improvements (2x+ speed), enhanced collection mapping API, custom type converters, conditional mapping, transformation functions, configuration validation, improved error messages | ✅ Fully backward compatible | Core improvements, mapping features, custom conversions |
3175
| 1.4.0 | Jan 2026 | Complex nested mapping, circular reference handling, performance diagnostics, generic collection interfaces, interface-to-concrete mapping, dictionary mapping, .NET Standard compatibility | ✅ Fully backward compatible | Advanced mapping, type features, enhanced conversions |
3276
| 2.1.0 | Mid 2026 | Pre-compiled mappings, reverse mapping, async transformations, async collection processing, LINQ expressions, projection support, detailed tracing | ❌ Contains breaking changes (new async methods in IMapper) | Next-gen features, async operations, data access integration |
3377

3478
Please see [Release Roadmap](https://github.com/CodeShayk/TurboMapper/blob/master/Release_Roadmap.md) for more details.
3579

80+
## Key Features in Release 1.2.0
81+
- **Performance Improvements**: Significant performance enhancements (2x+) through compiled expression trees and metadata caching
82+
- **Enhanced Collection Mapping**: Simplified API with Map method now supporting both single objects and collections
83+
- **Ignored Properties Option**: Added Ignore method to IMappingExpression to skip properties during mapping
84+
- **Custom Type Converters Registration**: Added RegisterConverter method to IMapper for custom type conversion functions
85+
- **Improved Nullable Type Handling**: Enhanced ConvertValue method to handle nullable types properly
86+
- **Conditional Mapping**: Added When method to IMappingExpression for conditional property mapping
87+
- **Mapping Transformations**: Added MapWith method for transformation functions during mapping
88+
- **Comprehensive Type Conversions**: Enhanced ConvertValue with DateTime, TimeSpan, and other common type conversions
89+
- **Configuration Validation**: Added ValidateMapping and GetMappingErrors methods to IMapper for early validation
90+
- **Improved Error Messages**: Better debugging information for conversion failures
91+
3692
## Contributing
3793
We welcome contributions! Please see our Contributing Guide for details.
3894
- 🐛 Bug Reports - If you are having problems, please let me know by raising a [new issue](https://github.com/CodeShayk/TurboMapper/issues/new/choose).

src/TurboMapper/IMapper.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
14
namespace TurboMapper
25
{
36
public interface IMapper
47
{
58
TTarget Map<TSource, TTarget>(TSource source);
9+
IEnumerable<TDestination> Map<TSource, TDestination>(IEnumerable<TSource> source);
10+
void RegisterConverter<TSource, TDestination>(Func<TSource, TDestination> converter);
11+
bool ValidateMapping<TSource, TTarget>();
12+
string[] GetMappingErrors<TSource, TTarget>();
613
}
714
}

src/TurboMapper/IMappingExpression.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ namespace TurboMapper
66
public interface IMappingExpression<TSource, TTarget>
77
{
88
IMappingExpression<TSource, TTarget> ForMember<TValue>(Expression<Func<TTarget, TValue>> targetMember, Expression<Func<TSource, TValue>> sourceMember);
9+
IMappingExpression<TSource, TTarget> Ignore<TValue>(Expression<Func<TTarget, TValue>> targetMember);
10+
IMappingExpression<TSource, TTarget> When<TValue>(Expression<Func<TTarget, TValue>> targetMember, Func<TSource, bool> condition);
11+
IMappingExpression<TSource, TTarget> MapWith<TSourceValue, TTargetValue>(Expression<Func<TTarget, TTargetValue>> targetMember, Func<TSourceValue, TTargetValue> transformFunction);
912
}
1013
}

0 commit comments

Comments
 (0)