Skip to content

Commit 6011984

Browse files
committed
- Add XML Documentation
1 parent e6eb454 commit 6011984

File tree

10 files changed

+842
-23
lines changed

10 files changed

+842
-23
lines changed

src/TurboMapper/IMapper.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
11
namespace TurboMapper
22
{
3+
/// <summary>
4+
/// Defines methods for mapping objects and validating mappings.
5+
/// </summary>
36
public interface IMapper
47
{
8+
/// <summary>
9+
/// Maps an object of type TSource to an object of type TTarget.
10+
/// </summary>
11+
/// <typeparam name="TSource"></typeparam>
12+
/// <typeparam name="TTarget"></typeparam>
13+
/// <param name="source"></param>
14+
/// <returns></returns>
515
TTarget Map<TSource, TTarget>(TSource source);
16+
/// <summary>
17+
/// Maps a collection of objects of type TSource to a collection of objects of type TDestination.
18+
/// </summary>
19+
/// <typeparam name="TSource"></typeparam>
20+
/// <typeparam name="TDestination"></typeparam>
21+
/// <param name="source"></param>
22+
/// <returns></returns>
23+
IEnumerable<TDestination> Map<TSource, TDestination>(IEnumerable<TSource> source);
24+
/// <summary>
25+
/// Validates the mapping configuration between TSource and TTarget types.
26+
/// </summary>
27+
/// <typeparam name="TSource"></typeparam>
28+
/// <typeparam name="TTarget"></typeparam>
29+
/// <returns></returns>
30+
ValidationResult ValidateMapping<TSource, TTarget>();
631
}
732
}

src/TurboMapper/IMappingExpression.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,44 @@
33

44
namespace TurboMapper
55
{
6+
/// <summary>
7+
/// Defines a mapping expression for configuring property mappings between source and target types.
8+
/// </summary>
9+
/// <typeparam name="TSource"></typeparam>
10+
/// <typeparam name="TTarget"></typeparam>
611
public interface IMappingExpression<TSource, TTarget>
712
{
13+
/// <summary>
14+
/// Configures a mapping for a specific member from the source type to the target type.
15+
/// </summary>
16+
/// <typeparam name="TValue"></typeparam>
17+
/// <param name="targetMember"></param>
18+
/// <param name="sourceMember"></param>
19+
/// <returns></returns>
820
IMappingExpression<TSource, TTarget> ForMember<TValue>(Expression<Func<TTarget, TValue>> targetMember, Expression<Func<TSource, TValue>> sourceMember);
21+
/// <summary>
22+
/// Ignores a specific member in the target type during the mapping process.
23+
/// </summary>
24+
/// <typeparam name="TValue"></typeparam>
25+
/// <param name="targetMember"></param>
26+
/// <returns></returns>
27+
IMappingExpression<TSource, TTarget> Ignore<TValue>(Expression<Func<TTarget, TValue>> targetMember);
28+
/// <summary>
29+
/// Applies a condition to a specific member in the target type, determining whether it should be mapped based on the provided condition function.
30+
/// </summary>
31+
/// <typeparam name="TValue"></typeparam>
32+
/// <param name="targetMember"></param>
33+
/// <param name="condition"></param>
34+
/// <returns></returns>
35+
IMappingExpression<TSource, TTarget> When<TValue>(Expression<Func<TTarget, TValue>> targetMember, Func<TSource, bool> condition);
36+
/// <summary>
37+
/// Maps a target member using a custom transformation function that takes a source value and produces a target value.
38+
/// </summary>
39+
/// <typeparam name="TSourceValue"></typeparam>
40+
/// <typeparam name="TTargetValue"></typeparam>
41+
/// <param name="targetMember"></param>
42+
/// <param name="transformFunction"></param>
43+
/// <returns></returns>
44+
IMappingExpression<TSource, TTarget> MapWith<TSourceValue, TTargetValue>(Expression<Func<TTarget, TTargetValue>> targetMember, Func<TSourceValue, TTargetValue> transformFunction);
945
}
1046
}

src/TurboMapper/IMappingModule.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
namespace TurboMapper
22
{
3+
/// <summary>
4+
/// Defines a module for configuring object mappings.
5+
/// </summary>
36
internal interface IMappingModule
47
{
8+
/// <summary>
9+
/// Configures mappings using the provided IObjectMap instance.
10+
/// </summary>
11+
/// <param name="mapper"></param>
512
void CreateMap(IObjectMap mapper);
613
}
714
}

src/TurboMapper/IObjectMap.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,32 @@
22

33
namespace TurboMapper
44
{
5+
/// <summary>
6+
/// Defines methods for configuring object mappings.
7+
/// </summary>
58
internal interface IObjectMap
69
{
10+
/// <summary>
11+
/// Creates a mapping configuration between TSource and TTarget types with optional property mappings.
12+
/// </summary>
13+
/// <typeparam name="TSource"></typeparam>
14+
/// <typeparam name="TTarget"></typeparam>
15+
/// <param name="mappings"></param>
716
void CreateMap<TSource, TTarget>(List<PropertyMapping> mappings = null);
8-
17+
/// <summary>
18+
/// Creates a mapping configuration between TSource and TTarget types with specified property mappings and an option to enable default mapping for unmapped properties.
19+
/// </summary>
20+
/// <typeparam name="TSource"></typeparam>
21+
/// <typeparam name="TTarget"></typeparam>
22+
/// <param name="mappings"></param>
23+
/// <param name="enableDefaultMapping"></param>
924
void CreateMap<TSource, TTarget>(List<PropertyMapping> mappings, bool enableDefaultMapping);
25+
/// <summary>
26+
/// Registers a custom converter function to convert from TSource to TDestination types.
27+
/// </summary>
28+
/// <typeparam name="TSource"></typeparam>
29+
/// <typeparam name="TDestination"></typeparam>
30+
/// <param name="converter"></param>
31+
void RegisterConverter<TSource, TDestination>(Func<TSource, TDestination> converter);
1032
}
1133
}

0 commit comments

Comments
 (0)