public void BasicFillTwice() { List <TestCustomer> customers = new List <TestCustomer>(); const string commandText = "SELECT TOP 10 CustomerID as CustomerId, AccountNumber, TerritoryID as TerritoryId FROM Sales.Customer"; using (IEntityAdapter adapter = new SqlEntityAdapter(connectionString, commandText)) { adapter.FillCollection(customers); customers = new List <TestCustomer>(); adapter.FillCollection(customers); } }
public void FillWithoutMappingsErrorOnSurplusColumn() { List <TestCustomer> customers = new List <TestCustomer>(); const string commandText = "SELECT TOP 10 CustomerID AS Customer, AccountNumber, TerritoryID as TerritoryId FROM Sales.Customer"; using (IEntityAdapter adapter = new SqlEntityAdapter(connectionString, commandText)) { adapter.FillCollection(customers); } }
public void BasicFill() { List <TestCustomer> customers = new List <TestCustomer>(); const string commandText = "SELECT TOP 10 CustomerID as CustomerId, AccountNumber, TerritoryID as TerritoryId FROM Sales.Customer"; using (IEntityAdapter adapter = new SqlEntityAdapter(connectionString, commandText)) { adapter.FillCollection(customers); } Assert.AreEqual(10, customers.Count); Assert.AreEqual(1, customers[0].CustomerId); Assert.IsTrue(customers[0].Rowguid == Guid.Empty); }
public void FillWithoutMappingsIgnoreSurplusColumn() { List <TestCustomer> customers = new List <TestCustomer>(); const string commandText = "SELECT TOP 10 CustomerID AS Customer, AccountNumber, TerritoryID as TerritoryId FROM Sales.Customer"; using (IEntityAdapter adapter = new SqlEntityAdapter(connectionString, commandText)) { adapter.MissingPropertyMappingAction = MissingPropertyMappingAction.Ignore; adapter.FillCollection(customers); } Assert.AreEqual(10, customers.Count); Assert.AreEqual(0, customers[0].CustomerId); Assert.IsTrue(customers[0].Rowguid == Guid.Empty); }