public static void InsertCustomer( string id, string companyName, string contactName = null, string contactTitle = null, string address = null, string city = null, string region = null, string postalCode = null, string country = null, string phone = null, string fax = null ) { using (new UnitOfWorkScope(true)) { Customer customer = new Customer(); customer.CustomerID = id; customer.CompanyName = companyName; customer.ContactName = contactName; customer.ContactTitle = contactTitle; customer.Address = address; customer.City = city; customer.Region = region; customer.PostalCode = postalCode; customer.Country = country; customer.Phone = phone; customer.Fax = fax; UnitOfWorkScope.NorthwindContext.Customers.Add(customer); } }
public static void TestUnion(Customer c) { var test = c.Orders.Union(c.Orders2).Select(o => o.Id); }
public static void LINQJoinIntoMethod(Customer c) { var q = c.Orders.GroupJoin(c.Orders2, o => o.Id, o2 => o2.Id, (o, o2s) => new { O = o, Os = o2s }).SelectMany(oo => oo.Os.DefaultIfEmpty(), (o, o2) => new {OrderOrder = o, Order2 = o2 }).Select(oo => new { oo.OrderOrder.O.Date, Date2 = oo.Order2.Date }); }
public static void LINQJoinInto(Customer c) { var q = from o in c.Orders join o2 in c.Orders2 on o.Id equals o2.Id into os from o2 in os.DefaultIfEmpty() select new { o.Date, Date2 = o2.Date }; }
public void DoSomethingWithCustomer() { var myCustomer = new Customer(); PrintCustomer(myCustomer); }