NetPro.AutoMapper 6.0.16

dotnet add package NetPro.AutoMapper --version 6.0.16
NuGet\Install-Package NetPro.AutoMapper -Version 6.0.16
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="NetPro.AutoMapper" Version="6.0.16" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPro.AutoMapper --version 6.0.16
#r "nuget: NetPro.AutoMapper, 6.0.16"
#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 NetPro.AutoMapper as a Cake Addin
#addin nuget:?package=NetPro.AutoMapper&version=6.0.16

// Install NetPro.AutoMapper as a Cake Tool
#tool nuget:?package=NetPro.AutoMapper&version=6.0.16

NetPro.AutoMapper使用

NuGet

引用此nuget包即可自动实现各种注册配置,引用后直接按下方步骤使用即可,无需再关心初始化等操作 备注:默认增强启动模式,故需要入口处添加以下代码,如果以脚手架创建的项目可忽略此设置

Environment.SetEnvironmentVariable("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", "NetPro.Startup");
  • 1、配置映射关系 继承IOrderedMapperProfile以实现批量注册
/// <summary>
/// 实体之间隐射配置
/// 数据库实体与AO业务实体互相映射
/// </summary>
public class UserMapper : Profile, IOrderedMapperProfile
{
    /// <summary>
    /// 
    /// </summary>
    public UserMapper()
    {
        //数据库实体映射AO业务实体,ReverseMap可实现双向映射
        CreateMap<UserInsertAo, User>().ReverseMap();
        CreateMap<UserUpdateAo, User>().ReverseMap();
    }

    /// <summary>
    /// 映射顺序,默认0即可,无需更改
    /// </summary>
    public int Order => 0;
}
  • 2、使用automapper映射转换
public class FreeSQLDemoService : IFreeSQLDemoService
    {
        private readonly IMapper _mapper;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="fsql"></param>
        /// <param name="idleFsql"></param>
        /// <param name="mapper"></param>
        public FreeSQLDemoService(IMapper mapper)
        {
            _mapper = mapper;
        }

        public void InsertAsync(UserInsertAo userInsertAo)
        {
            //AO实体隐射为数据库DO实体
            var userEntity = _mapper.Map<UserInsertAo, User>(userInsertAo);
        }
 }

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on NetPro.AutoMapper:

Repository Stars
LeonKou/NetPro
🌈An enhanced version with clean architecture of asp.netcore,efficiently manage startup,Support for netcore3.1/6.0
Version Downloads Last updated
6.0.16 237 7/24/2023
6.0.15 677 7/19/2022
6.0.14 419 7/10/2022
6.0.13 442 6/15/2022
6.0.12 393 6/15/2022
6.0.11 373 6/15/2022
6.0.10 397 6/11/2022
6.0.9 398 6/8/2022
6.0.8 456 5/26/2022
6.0.8-beta.3 137 5/24/2022
6.0.8-beta.2 105 5/24/2022
6.0.7 415 5/18/2022
6.0.6 421 4/28/2022
6.0.5 420 3/30/2022
6.0.5-beta.20 109 4/27/2022
6.0.5-beta.19 109 4/25/2022
6.0.5-beta.18 110 4/22/2022
6.0.5-beta.17 123 4/16/2022
6.0.5-beta.16 186 4/8/2022
6.0.5-beta.15 113 4/8/2022
6.0.5-beta.14 120 4/7/2022
6.0.5-beta.13 120 4/7/2022
6.0.5-beta.12 114 4/6/2022
6.0.5-beta.11 140 4/6/2022
6.0.5-beta.10 139 3/31/2022
6.0.5-beta.9 128 3/26/2022
6.0.5-beta.8 141 3/22/2022
6.0.5-beta.7 126 3/21/2022
6.0.5-beta.6 136 3/14/2022
6.0.5-beta.5 134 3/2/2022
6.0.5-beta.4 133 2/22/2022
6.0.5-beta.3 129 2/18/2022
6.0.5-beta.2 122 2/18/2022
6.0.5-beta.1 123 2/16/2022
6.0.4 449 2/10/2022
6.0.3-beta.9 115 2/10/2022