Skip to content
A convention-based object-object mapper in .NET.
C# PowerShell
Branch: master
Clone or download

Latest commit

jbogard Merge pull request #3415 from AutoMapper/apicompat
Exclude some public members from api checks
Latest commit 5f1e1a4 May 20, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github https://github.com/apps/lock May 5, 2019
docs Update Flattening.md May 8, 2020
lib Cleaning out the junk drawer Apr 5, 2017
src exclude some public members from api checks May 13, 2020
.editorconfig add a few more Aug 29, 2019
.gitattributes I give up on line endings. GitHub, stop giving people crappy advice o… Aug 27, 2013
.gitignore use gitignore instead Jun 25, 2019
.readthedocs.yml Migrate documentation from github to readthedocs Oct 9, 2017
AutoMapper.sln Configure Visual Studio to Name Private Fields with Underscore Aug 23, 2019
AutoMapper.snk Normalizing solution Apr 6, 2017
CONTRIBUTING.md Update CONTRIBUTING.md Mar 19, 2019
Directory.Build.props <VersionPrefix>9.1.0</VersionPrefix> Nov 15, 2019
ISSUE_TEMPLATE.md Update ISSUE_TEMPLATE.md Aug 16, 2019
LICENSE.txt Update LICENSE.txt Jul 31, 2018
README.md Update README.md Jan 15, 2020
appveyor.yml disallow mapping into a read-only collection without a setter Apr 29, 2020
default.ps1 remove the symbols package Oct 16, 2018
nuget.config exclude some public members from api checks May 13, 2020
nuget.exe Normalizing solution Apr 6, 2017
psake.cmd Cleaning out the junk drawer Apr 5, 2017
psake.ps1 Cleaning out the junk drawer Apr 5, 2017
psake.psd1 Cleaning out the junk drawer Apr 5, 2017
psake.psm1 Cleaning out the junk drawer Apr 5, 2017

README.md

AutoMapper

Build status NuGet MyGet (dev)

What is AutoMapper?

AutoMapper is a simple little library built to solve a deceptively complex problem - getting rid of code that mapped one object to another. This type of code is rather dreary and boring to write, so why not invent a tool to do it for us?

This is the main repository for AutoMapper, but there's more:

How do I get started?

First, configure AutoMapper to know what types you want to map, in the startup of your application:

var configuration = new MapperConfiguration(cfg => 
{
    cfg.CreateMap<Foo, FooDto>();
    cfg.CreateMap<Bar, BarDto>();
});
// only during development, validate your mappings; remove it before release
configuration.AssertConfigurationIsValid();
// use DI (http://docs.automapper.org/en/latest/Dependency-injection.html) or create the mapper yourself
var mapper = configuration.CreateMapper();

Then in your application code, execute the mappings:

var fooDto = mapper.Map<FooDto>(foo);
var barDto = mapper.Map<BarDto>(bar);

Check out the getting started guide. When you're done there, the wiki goes in to the nitty-gritty details. If you have questions, you can post them to Stack Overflow or in our Gitter.

Where can I get it?

First, install NuGet. Then, install AutoMapper from the package manager console:

PM> Install-Package AutoMapper

Do you have an issue?

First check if it's already fixed by trying the MyGet build.

You might want to know exactly what your mapping does at runtime.

If you're still running into problems, file an issue above.

License, etc.

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

AutoMapper is Copyright © 2009 Jimmy Bogard and other contributors under the MIT license.

.NET Foundation

This project is supported by the .NET Foundation.

You can’t perform that action at this time.