DD.WellWorkover.Cloud/ConsoleApp1/Program.cs
2021-04-07 18:01:56 +05:00

61 lines
1.6 KiB
C#

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<AsbCloudDbContext>()
// .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<Header>
{
new Header {Name = "P1", PropertyType = typeof(int) },
new Header {Name = "P2", PropertyType = typeof(int) },
new Header {Name = "P3", PropertyType = typeof(int) },
},
Rows = new List<object[]>
{
new object[] {1,2,3 },
new object[] {4,5,6 },
new object[] {7,8,9 },
}
};
var mapper = new TableMapper<B>();
var b = new B();
mapper.UpdateObjectFromTable(ref b, table, 1);
Console.WriteLine("Done");
}
}
}