AgileMapper is a powerful and unopinionated object mapper for .NET 3.5+ and .NET Standard 1.0+. It flattens, unflattens, deep clones, merges, updates and projects queries. It works without configuration, but if needed, is highly and easily configurable.

AgileMapper 1.8 is now available on NuGet with refinements, fixes, and a new option for configuring data sources.

Configuring Matcher Data Sources

AgileMapper has long supported ignoring target members (and source members) using filters - Funcs which match members based on their types, names, paths, attributes, etc. The same filters can now be used to configure source values to matched target members.

For example, say you have a set of source models with bool properties which map to target model string members, which expect "Yes" or "No" instead of true or false. By marking your target members with YesOrNoAttributes, this can be configured like so:

// Configure bool -> string mappings to map 'Yes' or 'No'
// if the target string member has a YesOrNoAttribute

// ToTarget() applies the source value to any matching 
// target string member:
	.IfTargetMemberMatches(m => 
	.Map((bl, str) => bl ? "Yes" : "No")

This DotNetFiddle shows a live example.

Ignoring Unusual Base Class Library Classes

AgileMapper now ignores BCL classes which aren’t commonly used in models. For example, if a model has a PropertyInfo member, AgileMapper would previously try to figure out how to map it, find that it couldn’t, and move on. It now skips BCL classes except those usually found in models - Lists, Dictionaries, etc. This makes for faster mapper creation.

NET Standard 2.0 Target

As a downstream consequence of a .NET Standard 2.0 target being added to ReadableExpressions, AgileMapper now has an additional .NET Standard 2.0 target. This makes it more easily consumable from packages or apps which target .NET Standard 2.0. With support going all the way back to .NET Framework 3.5, AgileMapper is an option for a very wide range of projects!

Please report any issues or suggestions on GibHub. Happy mapping!