/// <summary>
        /// EFDBFirst ile yeni bir kayıt ekleme işlemi.
        /// </summary>
        /// <param name="data"></param>
        static void addNewCustomer(Customer data)
        {
            YTUEFEntities context = new YTUEFEntities();

            context.Customer.Add(data);
            context.SaveChanges();
        }
        static void deleteCustomer(int customerID)
        {
            YTUEFEntities context   = new YTUEFEntities();
            Customer      theRecord = context.Customer.Find(customerID);

            if (theRecord != null)
            {
                context.Customer.Remove(theRecord);
                context.SaveChanges();
            }
        }
        static void updateCustomer(int customerID, string FirstName, string LastName)
        {
            YTUEFEntities context   = new YTUEFEntities();
            Customer      theRecord = context.Customer.Find(customerID);

            if (theRecord != null)
            {
                theRecord.FirstName = FirstName;
                theRecord.LastName  = LastName;
                context.SaveChanges();
            }
        }
        static void learnTransaction(Customer dataCustomer, Product dataProduct)
        {
            YTUEFEntities context = new YTUEFEntities();

            #region Transaction ile kullanımı
            using (DbContextTransaction trns = context.Database.BeginTransaction())
            {
                try
                {
                    context.CustomerProductLists.Add(new CustomerProductList()
                    {
                        Amount     = 1,
                        ListPrice  = dataProduct.ListPrice,
                        ProductId  = dataProduct.ProductID,
                        CustomerId = dataCustomer.CustomerID,
                        CreateDate = DateTime.Now
                    });
                    context.SaveChanges(); // SQL INSERT

                    //throw new Exception();

                    context.CustomerHistories.Add(new CustomerHistory()
                    {
                        productID  = dataProduct.ProductID,
                        amount     = 1,
                        stateCode  = 100,
                        createDate = DateTime.Now
                    });

                    context.SaveChanges();

                    trns.Commit(); // Onaylamak tüm işlemleri onaylıyorsunuz...
                }
                catch (Exception ex)
                {
                    trns.Rollback(); // Geri çağırma işlemi...
                }
            }
            #endregion

            #region Transaction olmadan kullanım

            context.CustomerProductLists.Add(new CustomerProductList()
            {
                Amount     = 1,
                ListPrice  = dataProduct.ListPrice,
                ProductId  = dataProduct.ProductID,
                CustomerId = dataCustomer.CustomerID,
                CreateDate = DateTime.Now
            });
            context.SaveChanges(); // SQL INSERT

            context.CustomerHistories.Add(new CustomerHistory()
            {
                productID  = dataProduct.ProductID,
                amount     = 1,
                stateCode  = 100,
                createDate = DateTime.Now
            });

            context.SaveChanges();
            #endregion
        }