public void G10_InsertCharSerialPrimaryKey() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); try { db.ExecuteCommand( @"create sequence seq8; create temp table cust1 ( CustomerID char(10) DEFAULT nextval('seq8'), dummy text ); "); Table <Northwind1.Cust1> cust1s = db.GetTable <Northwind1.Cust1>(); var cust1 = new Northwind1.Cust1(); cust1.Dummy = ""; db.Cust1s.InsertOnSubmit(cust1); db.SubmitChanges(); Assert.IsNotNull(cust1.CustomerId); } finally { try { db.ExecuteCommand("drop table cust1;"); } catch { } try { db.ExecuteCommand("drop sequence seq8;"); } catch { } } }
public void D12_SelectDerivedClass() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); var derivedCustomer = (from c in db.ChildCustomers where c.City == "London" select c).First(); Assert.IsTrue(derivedCustomer.City == "London"); }
public void DifferentParentAndAssociationPropertyNames() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); var query = db.GetTable <Northwind1.ExtendedOrder>() as IQueryable <Northwind1.ExtendedOrder>; var q2 = query.Select(e => new Northwind1.ExtendedOrder { OrderID = e.OrderID, ShipAddress = e.CustomerShipCity.ContactName }); var list = q2.ToList(); Assert.IsTrue(list.Count > 0); }
public void RetrieveParentAssociationProperty() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); var t = db.GetTable <Northwind1.ExtendedOrder>(); var q = from order in t select new { order.OrderID, order.CustomerShipCity.ContactName }; var list = q.ToList(); Assert.IsTrue(list.Count > 0); }
public void SelectCustomerContactNameFromOrder() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); var t = db.GetTable <Northwind1.ExtendedOrder>(); var q = from order in t select new { order.CustomerContactName }; var list = q.ToList(); Assert.AreEqual(db.Orders.Count(), list.Count()); foreach (var s in list) { Assert.AreEqual("Test", s); } }
public void SelectCustomerContactNameFromOrder() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); var t = db.GetTable<Northwind1.ExtendedOrder>(); var q = from order in t select new { order.CustomerContactName }; var list = q.ToList(); Assert.AreEqual(db.Orders.Count(), list.Count()); foreach (var s in list) Assert.AreEqual("Test", s); }
public void DifferentParentAndAssociationPropertyNames() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); var query = db.GetTable<Northwind1.ExtendedOrder>() as IQueryable<Northwind1.ExtendedOrder>; var q2 = query.Select(e => new Northwind1.ExtendedOrder { OrderID = e.OrderID, ShipAddress = e.CustomerShipCity.ContactName }); var list = q2.ToList(); Assert.IsTrue(list.Count > 0); }
public void RetrieveParentAssociationProperty() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); var t = db.GetTable<Northwind1.ExtendedOrder>(); var q = from order in t select new { order.OrderID, order.CustomerShipCity.ContactName }; var list = q.ToList(); Assert.IsTrue(list.Count > 0); }
public void G10_InsertCharSerialPrimaryKey() { Northwind dbo = CreateDB(); Northwind1 db = new Northwind1(dbo.Connection); try { db.ExecuteCommand( @"create sequence seq8; create temp table cust1 ( CustomerID char(10) DEFAULT nextval('seq8'), dummy text ); "); Table<Northwind1.Cust1> cust1s = db.GetTable<Northwind1.Cust1>(); var cust1 = new Northwind1.Cust1(); cust1.Dummy = ""; db.Cust1s.InsertOnSubmit(cust1); db.SubmitChanges(); Assert.IsNotNull(cust1.CustomerId); } finally { try { db.ExecuteCommand("drop table cust1;"); } catch { } try { db.ExecuteCommand("drop sequence seq8;"); } catch { } } }