Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }