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 314 7/24/2023
6.0.15 720 7/19/2022
6.0.14 449 7/10/2022
6.0.13 472 6/15/2022
6.0.12 420 6/15/2022
6.0.11 389 6/15/2022
6.0.10 430 6/11/2022
6.0.9 415 6/8/2022
6.0.8 488 5/26/2022
6.0.8-beta.3 152 5/24/2022
6.0.8-beta.2 118 5/24/2022
6.0.7 445 5/18/2022
6.0.6 437 4/28/2022
6.0.5 442 3/30/2022
6.0.5-beta.20 123 4/27/2022
6.0.5-beta.19 123 4/25/2022
6.0.5-beta.18 129 4/22/2022
6.0.5-beta.17 135 4/16/2022
6.0.5-beta.16 200 4/8/2022
6.0.5-beta.15 127 4/8/2022
6.0.5-beta.14 140 4/7/2022
6.0.5-beta.13 138 4/7/2022
6.0.5-beta.12 126 4/6/2022
6.0.5-beta.11 159 4/6/2022
6.0.5-beta.10 152 3/31/2022
6.0.5-beta.9 141 3/26/2022
6.0.5-beta.8 154 3/22/2022
6.0.5-beta.7 139 3/21/2022
6.0.5-beta.6 149 3/14/2022
6.0.5-beta.5 149 3/2/2022
6.0.5-beta.4 146 2/22/2022
6.0.5-beta.3 142 2/18/2022
6.0.5-beta.2 135 2/18/2022
6.0.5-beta.1 136 2/16/2022
6.0.4 479 2/10/2022
6.0.3-beta.9 127 2/10/2022