MyFramework.Core.Reflection 1.0.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package MyFramework.Core.Reflection --version 1.0.0.6
NuGet\Install-Package MyFramework.Core.Reflection -Version 1.0.0.6
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="MyFramework.Core.Reflection" Version="1.0.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MyFramework.Core.Reflection --version 1.0.0.6
#r "nuget: MyFramework.Core.Reflection, 1.0.0.6"
#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 MyFramework.Core.Reflection as a Cake Addin
#addin nuget:?package=MyFramework.Core.Reflection&version=1.0.0.6

// Install MyFramework.Core.Reflection as a Cake Tool
#tool nuget:?package=MyFramework.Core.Reflection&version=1.0.0.6

MyFramework.Core.Reflection

介绍

对象赋值组件 (clase1的对象的值 赋值给class2)

软件架构

安装教程

Install-Package MyFramework.Core.Reflection

使用示例
1. 调用示例
using MyFramework.Core.Reflection.Attribute;
using System;
using System.Collections.Generic;
using System.Text;

namespace MyFramework.Core.Reflection.Sample
{
    public class MappingHelperSample
    {
        /// <summary>
        /// 
        /// </summary>
        public static void Run()
        {
            T_001 s = new T_001()
            {
                TaskID = 1,
                SN = "code001",
                Text = "text001",
                list_t_2 = new List<T_001_001>() {
                    new T_001_001() {ItemID=1,TaskID=1,Line=1,Text="text001_01" },
                    new T_001_001() {ItemID=2,TaskID=1,Line=2,Text="text001_02" },
                }
            };
            //简单映射(只根据属性名称) 等同于 MappingHelper.Mapping<T_001, T_101>(s, true, Enums.MappingOptionEnum.Field);
            T_101 t_101_sample0 = MappingHelper.SimpleMapping<T_001, T_101>(s, true);
            //根据类的特性([FieldMapping])匹配(正向匹配)(作用于T)
            T_101 t_101_sample1 = MappingHelper.Mapping<T_001, T_101>(s, true, Enums.MappingOptionEnum.Mapping);
            //根据类的特性([FieldRMapping])匹配(反向匹配)(作用于S)
            T_101 t_101_sample2 = MappingHelper.Mapping<T_001, T_101>(s, true, Enums.MappingOptionEnum.RMapping);
            //根据所有情况匹配(优先级:正向[FieldMapping](作用于T) >反向[FieldRMapping](作用于S)>[属性名称])
            T_101 t_101_sample3 = MappingHelper.Mapping<T_001, T_101>(s, true, Enums.MappingOptionEnum.ALL);
            //根据参数顺序匹配(当参数含有 MappingOptionEnum.ALL 时会按照 MappingOptionEnum.ALL 方式处理 忽略掉其它参数)
            T_101 t_101_sample4 = MappingHelper.Mapping<T_001, T_101>(s, true, Enums.MappingOptionEnum.Field, Enums.MappingOptionEnum.Mapping);

            //T类型对象已存在
            T_101 t_101_sample5 = new T_101() { TaskID = 100 };
            t_101_sample5 = MappingHelper.Mapping<T_001, T_101>(s, t_101_sample5, true, Enums.MappingOptionEnum.ALL);

            //多S类型(多数据源)
            T_101 t_101_sample6 = MappingHelper.Mapping<T_001, T_001, T_001, T_101>(s, s, s);
        }
    }
    public class T_001
    {
        public long TaskID { get; set; }
        public string SN { get; set; }
        [FieldRMapping(nameof(T_101.Name))]
        public string Text { get; set; }
        public List<T_001_001> list_t_2 { get; set; }

    }
    public class T_001_001
    {

        public long ItemID { get; set; }

        public long TaskID { get; set; }
        public int Line { get; set; }
        public string Text { get; set; }
    }

    public class T_101
    {
        public long TaskID { get; set; }
        public string SN { get; set; }
        [FieldMapping(nameof(T_001.Text))]
        public string Name { get; set; }
        public List<T_101_001> list_t_2 { get; set; }

    }
    public class T_101_001
    {
        public long ItemID { get; set; }

        public long TaskID { get; set; }
        public int Line { get; set; }
        public string Text { get; set; }
    }

    public class T_201
    {
        public long TaskID { get; set; }
        public string SN { get; set; }
        public string Content { get; set; }
        public List<T_201_001> list_t_2 { get; set; }

    }
    public class T_201_001
    {

        public long ItemID { get; set; }

        public long TaskID { get; set; }
        public int Line { get; set; }
        public string Text { get; set; }
    }
}

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net35 is compatible.  net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.2

    • No dependencies.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

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
1.0.0.11 341 3/26/2021
1.0.0.10 413 9/17/2020
1.0.0.9 392 8/31/2020
1.0.0.8 427 7/10/2020
1.0.0.7 469 7/10/2020
1.0.0.6 389 7/8/2020
1.0.0.5 395 7/1/2020
1.0.0.4 402 7/1/2020
1.0.0.3 483 11/20/2019
1.0.0.2 446 11/15/2019
1.0.0.1 443 11/14/2019