public void CopyTest()
        {
            IEntityMetaDataProvider provider = new DbSchemaMetaDataProvider();

            EntityMetaData metaData = (EntityMetaData)provider.CreateEntityMetaData(typeof (Invoices));

            var copy = metaData.Copy();

            int len = metaData.Properties.Count();

            Stopwatch bench = Stopwatch.StartNew();
            for (int j = 0; j < 1000000; ++j)
                metaData.Copy();
            bench.Stop();

            Debug.WriteLine("Schema Xml Copy: " +  bench.ElapsedMilliseconds);

            Assert.IsNotNull(metaData);
        }
示例#2
0
        public void MultipleQueryTests()
        {
            using (var c = DataFactory.CretDbClient())
            {
                var cmd = c.Cmd;// new EntityCommandSelect(c.DataAccess, '@');

                var provider = new DbSchemaMetaDataProvider();

                SqlQuery q = @"select o.*, c.* from Orders o
                inner join Customers c on o.CustomerID = c.CustomerID".ToQuery();

                var order = cmd.Query<Orders, Customers>(q, MapBy.Name);
                order = cmd.Query<Orders, Customers>(q, MapBy.Sequence);

                q = @"select o.ShipName, o.ShipCountry, c.ContactName, c.Country from Orders o
                inner join Customers c on o.CustomerID = c.CustomerID".ToQuery();

                order = cmd.Query<Orders, Customers>(q, MapBy.Name);
                // order = cmd.QuerySingle<Orders, Customers>(provider, q, MapBy.Sequence);

                q = @"select o.*, c.*, e.* from Orders o
                inner join Customers c on o.CustomerID = c.CustomerID
                inner join Employees e on o.EmployeeID = e.EmployeeID".ToQuery();
                var order3 = cmd.Query<Orders, Customers, Employees>(q, MapBy.Name);
                order3 = cmd.Query<Orders, Customers, Employees>(q, MapBy.Sequence);
                dynamic dyn = c.DataAccess.Query(provider, q, MapBy.Name, '@', typeof(Orders), typeof(Customers), typeof(Employees));
                dyn = c.DataAccess.Query(provider, q, MapBy.Sequence, '@',typeof(Orders), typeof(Customers), typeof(Employees));


                for (int j = 0; j < 10; ++j)
                {
                    order3 = cmd.Query<Orders, Customers, Employees>(q, MapBy.Name);
                    order3 = cmd.Query<Orders, Customers, Employees>(q, MapBy.Sequence);
                }


                Assert.IsNotNull(order);

            }
        }