Entity.Mapper.Asp 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Entity.Mapper.Asp --version 1.0.0
NuGet\Install-Package Entity.Mapper.Asp -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Entity.Mapper.Asp" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Entity.Mapper.Asp --version 1.0.0
#r "nuget: Entity.Mapper.Asp, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Entity.Mapper.Asp as a Cake Addin
#addin nuget:?package=Entity.Mapper.Asp&version=1.0.0

// Install Entity.Mapper.Asp as a Cake Tool
#tool nuget:?package=Entity.Mapper.Asp&version=1.0.0

EntityMapper Documentation

Introducion

AutoMapper is a powerful and flexible object-to-object mapping library for .NET applications. It simplifies the process of mapping one object's properties to another, allowing you to focus on writing clean and maintainable code. This documentation provides a detailed guide on how to use AutoMapper in your .NET projects. It covers the basic setup, configuration, mapping, and integration with the ServiceCollection.

Basic Configuration

AutoMapper provides a straightforward way to configure object mapping. You can create a mapping configuration using the AutoMapper class and the AddConfiguration method.

var autoMapper = new AutoMapper();
autoMapper.AddConfiguration<UserDto, User>((user) => new UserDto()
{
    Id = user.Id,
    Name = user.Name
});

This code sets up a mapping from User objects to UserDto objects. It specifies how properties should be mapped from the source (User) to the destination (UserDto).

Mapping Objects

Once you have configured AutoMapper, you can easily map objects using the Map method.

var userDto = autoMapper.Map<User, UserDto>(user);

In this example, we map a User object to a UserDto object, and AutoMapper takes care of copying the properties according to the configuration.

ServiceCollection Integration

AutoMapper can be integrated with the ServiceCollection in ASP.NET Core applications to enable dependency injection of mappers. Here's how to set it up:

var serviceCollection = new ServiceCollection();
var mapper = serviceCollection.UseMapper();
mapper.AddMapperConfiguration<User, UserDto>((user) => new UserDto()
{
    Id = user.Id,
    Name = user.Name
});

This code configures AutoMapper to work with the ServiceCollection. It allows you to inject the mapper into your services, making it easy to use AutoMapper within your application's services and controllers.

Conclusion

AutoMapper is a powerful tool for simplifying object-to-object mapping in your .NET applications. By following this documentation, you can quickly set up and use AutoMapper to streamline your code and improve maintainability. It's worth noting that AutoMapper is extensively tested, with a test suite that achieves 100% code coverage to ensure its reliability and correctness in various scenarios. This comprehensive testing ensures that AutoMapper works seamlessly in your projects, providing confidence in its behavior and robustness.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.3.7 195 9/18/2023
2.3.6 199 9/18/2023
2.2.6 247 9/18/2023
2.2.5 200 9/9/2023
2.2.4 179 9/9/2023
2.2.3 243 9/9/2023
2.2.2 265 9/8/2023
2.2.1 253 9/8/2023
1.2.1 226 9/7/2023
1.1.1 257 9/6/2023
1.0.1 193 9/6/2023
1.0.0 237 9/6/2023

Initial