public static void DeleteCustomer(NORTHWNDEntities dataBase)
        {
            var customer = dataBase.Customers
                           .Where(c => c.CustomerID == "ABGRT")
                           .FirstOrDefault();

            dataBase.Customers.Remove(customer);

            dataBase.SaveChanges();
        }
        public static void ModifyCustomer(NORTHWNDEntities dataBase)
        {
            // selecting the new inserted customer entry to modify it
            var customer = dataBase.Customers
                            .Where(c => c.CustomerID == "ABGRT")
                            .FirstOrDefault();

            customer.ContactName = "Miroslav Ivanov";

            dataBase.SaveChanges();
        }
        public static void InsertNewCustomer(NORTHWNDEntities dataBase)
        {
            var newCustomer = new Customer
            {
                CustomerID = "ABGRT",
                CompanyName = "Nike",
                ContactName = "Miroslav Andonov",
                ContactTitle = "Owner",
                Address = "Mladost 4",
                City = "Sofia",
                Region = "Sofia",
                PostalCode = "1612",
                Country = "Bulgaria",
                Phone = "3-432-213-4",
                Fax = "3-324-213-12",
            };

            dataBase.Customers.Add(newCustomer);

            dataBase.SaveChanges();
        }
        static void Main()
        {
            // creating one of the database contexts used to simulate the multithreading
            using (var firstDataBase = new NORTHWNDEntities())
            {

                // selecting the first employee
                var employee = firstDataBase.Employees.FirstOrDefault();

                // changing the employee's country to Bulgaria
                employee.Country = "Bulgaria";

                //creating the second database
                using (var secondDataBase = new NORTHWNDEntities())
                {

                    // selecting the first employee again
                    var employeeSecond = secondDataBase.Employees.FirstOrDefault();

                    // changing the employee's country to England
                    employee.Country = "England";

                    secondDataBase.SaveChanges();
                } // here the second connection is closed

                firstDataBase.SaveChanges();
            }// first connection is closed

            // show the actual result
            using (var dbToShowResult = new NORTHWNDEntities())
            {
                var result = dbToShowResult.Employees.FirstOrDefault();

                Console.WriteLine("The first emplyee's country is: {0}", result.Country);
            }
        }