HcfNS.AutoMapper 7.0.2.1

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

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

Hcf AutoMapper 对象映射组件,封装基于AutoMapper的对象映射实现

用法

添加AutoMapper组件包

services.AddPack<AutoMapperPack>();

示例

克隆对象

using Hcf.AutoMapper;
using Hcf.Mapping;

TestInfo testInfo1 = new TestInfo()
{
    Id = 1,
    Name = Guid.NewGuid().ToString(),
    CreatedTime=DateTime.Now
};

var testInfo2 = testInfo1.MapTo<TestInfo>();

对象动态赋值

创建一个Dto类,标记可以从TestInfo类型映射

    /// <summary>
    /// TestOutputDto
    /// </summary>
    [MapFrom(typeof(TestInfo))]
    public class TestOutputDto
    {
        /// <summary>
        /// Id
        /// </summary>
        public int Id { set; get; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { set; get; }
    }

将testInfo1对象的值赋值给该Dto对象

var testInfo3 = testInfo1.MapTo<TestOutputDto>();
Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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 is compatible.  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. 
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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.2.1 84 12/23/2024
7.0.2 78 12/19/2024
7.0.1 91 11/22/2024
7.0.0 94 11/1/2024
6.0.12.1 136 9/4/2024
6.0.12 99 9/4/2024
6.0.11 106 9/4/2024
6.0.10 66 7/30/2024
6.0.9 72 7/30/2024
6.0.8.1 102 6/7/2024
6.0.8 118 4/28/2024
6.0.7 206 3/8/2024
6.0.6 450 12/27/2023
6.0.5.2 485 12/1/2023
6.0.5.1 466 11/14/2023
6.0.5 456 11/13/2023
6.0.4.1 476 11/3/2023
6.0.4 456 11/3/2023
6.0.3 452 10/31/2023
6.0.2 674 6/26/2023
6.0.1 910 10/18/2022
6.0.0.1 935 10/10/2022
6.0.0 922 8/17/2022
5.1.1 988 3/16/2022
5.0.1.6 864 8/5/2021
5.0.1.5 820 8/3/2021
5.0.1.4 874 8/2/2021
5.0.1.3 835 7/27/2021
5.0.1.2 960 6/27/2021
5.0.1.1 921 6/27/2021
5.0.1 827 6/19/2021
5.0.0 826 6/19/2021
3.3.11.1 898 3/2/2021
3.3.11 935 2/26/2021
3.3.10 935 2/24/2021
3.3.9 904 2/22/2021
3.3.8 940 12/17/2020
3.3.7.1 940 12/16/2020
3.3.7 1,022 12/12/2020
3.3.6 912 12/1/2020
3.3.5 919 12/1/2020
3.3.4.2 922 11/20/2020
3.3.4.1 1,006 11/19/2020
3.3.4 1,058 11/11/2020
3.3.3.1 993 10/20/2020
3.3.3 974 10/19/2020
3.3.2.2 950 10/9/2020
3.3.2.1 1,015 9/30/2020
3.3.2 1,001 9/30/2020
3.3.1 1,011 9/26/2020
3.3.0 1,023 9/3/2020
3.2.10.1 1,033 8/20/2020
3.2.10 1,016 8/10/2020
3.2.9.2 1,002 7/29/2020
3.2.9.1 1,054 7/29/2020
3.2.8.3 1,182 7/14/2020
3.2.8.2 1,158 7/14/2020
3.2.7.2 1,203 7/13/2020
3.2.7 1,367 7/12/2020
3.2.6 1,361 7/9/2020
3.2.4.1 1,453 6/20/2020
3.2.4 1,155 6/20/2020
3.2.3 1,509 6/20/2020
3.2.2 1,181 6/15/2020
3.2.1 1,062 6/12/2020
3.2.0.1 1,731 6/12/2020
3.2.0 1,655 6/9/2020
3.0.1 3,422 4/30/2020
3.0.0 1,704 4/26/2020