partial void DeleteCustomer(Customer instance);
partial void UpdateCustomer(Customer instance);
partial void InsertCustomer(Customer instance);
private void detach_Customers(Customer entity) { this.SendPropertyChanging(); entity.State1 = null; }
private void attach_Customers(Customer entity) { this.SendPropertyChanging(); entity.State1 = this; }
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(); }