using System;
using System.Linq;
using MvpSample.CustomerDb; //inutile après avoir déplacé EF model vers DomainClasses
// don't forgett to copy and paste connection string found in MvpSample.CustomerDb config file
// into this app.config file
// cif error check also with server explorer if sql express server is started
// if not open services manager from server explorer with right clic 
// can also be opened with Start Menu, type services.msc

using MvpSample.DomainClasses;
using MvpSample.DAL;

namespace TestEF
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var customerDbContainer = new CustomerDbContainer())
            {
                var company = new Company {Name="UFRTech"};
                customerDbContainer.CompanySet.Add(company);
                customerDbContainer.SaveChanges();
                company = customerDbContainer.CompanySet.FirstOrDefault(s => s.Name == "UFRTech");
                if (company != null)
                {
                    Console.WriteLine("key is:" + company.Id);
                }
                   
                else
                {
                    Console.WriteLine("no item"); 
                }
            }
            Console.ReadKey();
        }
    }
}
