Skip to content

Commit

Permalink
Value transformers documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Nov 9, 2017
1 parent 3b54a3d commit 0b892d3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/Value-transformers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Value Transformers

Value transformers apply an additional transormation to a single type. Before assigning the value, AutoMapper will check to see if the value to be set has any value transformations associated, and will apply them before setting.

You can create value transformers at several different levels:

- Globally
- Profile
- Map
- Member

```c#
Mapper.Initialize(cfg => {
cfg.ValueTransformers.Add<string>(val + "!!!");
});

var source = new Source { Value = "Hello" };
var dest = Mapper.Map<Dest>(source);

dest.Value.ShouldBe("Hello!!!");
```
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ New to AutoMapper? Check out the :doc:`Getting-started` page first.
Nested-mappings
Custom-type-converters
Custom-value-resolvers
Value-transformers
Null-substitution
Before-and-after-map-actions
Dependency-injection
Expand Down

0 comments on commit 0b892d3

Please sign in to comment.