using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using System;

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 e = new Event
            {
                IdEvent = 1,
                IdTelemetry = 1,
                IdCategory = 1,
                MessageTemplate = "template",
            };

            context.Events.Update(e).State = EntityState.Added;
            context.SaveChanges();


            //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. Press any key to quit.");
            Console.ReadKey();
        }


    }
}