private void detach_Invoices(Invoice entity)
		{
			this.SendPropertyChanging();
			entity.Customer = null;
		}
		private void attach_Invoices(Invoice entity)
		{
			this.SendPropertyChanging();
			entity.Customer = this;
		}
 partial void DeleteInvoice(Invoice instance);
 partial void UpdateInvoice(Invoice instance);
 partial void InsertInvoice(Invoice instance);
        private void FormLinqSample_Load(object sender, EventArgs e)
        {
            MMABooksDataContext db = new MMABooksDataContext();

            var inv = from c in db.Customers
                      join i in db.Invoices
                      on c.CustomerID equals i.CustomerID
                      orderby c.Name
                      select new { c.Name, i.InvoiceDate, i.InvoiceTotal };
            foreach (var i in inv)
            {
                Console.WriteLine(String.Format("{0}, {1}, {2}", i.Name, i.InvoiceDate, i.InvoiceTotal));
            }

            var customers = from c in db.Customers
                            orderby c.Name
                            select c;

            var list = new List<Customer>();
            foreach (Customer c in customers)
            {
                list.Add(c);
            }

            var reduced = from c in list
                          where CheckName(c.Name, "ub")
                          select c;

            foreach (Customer c in reduced)
            {
                listBox1.Items.Add(c.Name);
            }

            foreach (Customer c in customers)
            {
                c.Name.Replace("ub", "--ub--");
            }

            db.SubmitChanges();

            foreach (Customer c in customers)
            {
                c.Name.Replace("--ub--", "ub");
            }

            db.SubmitChanges();

            Customer me = new Customer();
            me.Name = "Stublen, Neal";
            me.Address = "12345 College Ave.";
            me.City = "Overland Park";
            me.State = "KS";
            me.ZipCode = "66???";
            db.Customers.InsertOnSubmit(me);

            db.SubmitChanges();

            Invoice invoice = new Invoice();
            invoice.InvoiceDate = DateTime.Now;
            me.Invoices.Add(invoice);

            db.SubmitChanges();
        }