discover · compare · collections · requirements · contribute · feed · watching · stats · help with your tokens
LuckyPennySoftware/AutoMapper · source
Snapshot 0 · 2026-11-04T12:47:21Z · C# ·
Content fingerprint
acbf2a7c7e0fb2a4cb7f2ea2cd9f580281416a8652d2e21e4b8cd856bc8ea1bcGitHub description at capture
A convention-based object-object mapper in .NET.
README at capture

[](https://github.com/luckypennysoftware/AutoMapper/actions?query=workflow%3ACI)
[](https://www.nuget.org/packages/AutoMapper/)
[](https://docs.automapper.io/en/stable/?badge=stable)
### 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:
* [Collection Extensions](https://github.com/AutoMapper/AutoMapper.Collection)
* [Expression Mapping](https://github.com/AutoMapper/AutoMapper.Extensions.ExpressionMapping)
* [EF6 Extensions](https://github.com/AutoMapper/AutoMapper.EF6)
* [IDataReader/Record Extensions](https://github.com/AutoMapper/AutoMapper.Data)
* [Enum Extensions](https://github.com/AutoMapper/AutoMapper.Extensions.EnumMapping)
### How do I get started?
First, configure AutoMapper to know what types you want to map, in the startup of your application:
```csharp
var configuration = new MapperConfiguration(cfg =>
{
cfg.CreateMap<Foo, FooDto>();
cfg.CreateMap<Bar, BarDto>();
}, loggerFactory);
// or more typically, using IServiceCollection with automatic service registration
services.AddAutoMapper(cfg =>
{
cfg.CreateMap<Foo, FooDto>();
cfg.CreateMap<Bar, BarDto>();
});
// AutoMapper will automatically register any implementations of:
// - IValueResolver<TSource, TDestination, TDestMember>
// - IMemberValueResolver<TSource, TDestination, TSourceMember, TDestMember>
// - ITypeConverter<TSource, TDestination>
// - IValueConverter<TSourceMember, TDestinationMember>
// - ICondition<TSource, TDestination, TDestMember>
// - IPreCondition<TSource, TDestination>
// - IMappingAction<TSource, TDestination>
// from the provided assemblies
// only during development, validate your mappings; remove it before release
#if DEBUG
configuration.AssertConfigurationIsValid();
#endif
// use DI (http://docs.automapper.io/en/latest/Dependency-injection.html) or create the mapper yourself
var mapper = configuration.CreateMapper();
```
Then in your application code, execute the mappings:
```csharp
var fooDto = mapper.Map<FooDto>(foo);
var barDto = mapper.Map<BarDto>(bar);
```
Check out the [getting started guide](https://automapper.readthedocs.io/en/latest/Getting-started.html). When you're done there, the [wiki](https://automapper.readthedocs.io/en/latest/) goes in to the nitty-gritty details. If you have questions, you can post them to [Stack Overflow](https://stackoverflow.com/questions/tagged/automapper).
### Where can I get it?
First, [install NuGet](http://docs.nuget.org/docs/start-here/installing-nuget). Then, install [AutoMapper](https://www.nuget.org/packages/AutoMapper/) from the package manager console:
```
PM> Install-Package AutoMapper
```
Or from the .NET CLI as:
```
dotnet add package AutoMapper
```
### Do you have an issue?
You might want to know exactly what [your mapping does](https://automapper.readthedocs.io/en/latest/Understanding-your-mapping.html) at runtime.
If you're still running into problems, file an issue above.
If you are a paying customer, you can contact support via your account.
### How do I set the license key?
The simplest way is to set an environment variable (AutoMapper 16.2.0 and later), with no code change needed:
- `AUTOMAPPER_LICENSE_KEY`: the AutoMapper license key.
- `LUCKYPENNY_LICENSE_KEY`: a key shared across Lucky Penny products. It must be for a license that includes AutoMapper.
Or you can set the license key in code when registering AutoMapper, which takes precedence over the environment variables:
```csharp
services.AddAutoMapper(cfg =>
{
cfg.LicenseKey = "<license key here>";
})
```
See [License configuration](https://docs.automapper.io/en/latest/License-configuration.html) for all the options.
You can register for your license key at [AutoMapper.io](https://automapper.io)