using AsbCloudDb.Model; using AsbCloudInfrastructure.Services.Cache; using AutoMapper; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace ConsoleApp1 { public class A { public int P1 { get; set; } public int P2 { get; set; } }; public class B { public int P1 { get; set; } public int P3 { get; set; } }; class Program { static void Main(string[] args) { //var options = new DbContextOptionsBuilder() // .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True") // .Options; //var context = new AsbCloudDbContext(options); var table = new Table { Headers = new List
{ new Header {Name = "P1", PropertyType = typeof(int) }, new Header {Name = "P2", PropertyType = typeof(int) }, new Header {Name = "P3", PropertyType = typeof(int) }, }, Rows = new List { new object[] {1,2,3 }, new object[] {4,5,6 }, new object[] {7,8,9 }, } }; var mapper = new TableMapper(); var b = new B(); mapper.UpdateObjectFromTable(ref b, table, 1); Console.WriteLine("Done"); } } }