Esempio n. 1
0
        private static void MeasureReflect()
        {
            ReflectDataMapper <string, Customer> customer = new ReflectDataMapper <string, Customer>(typeof(Customer), connStr, false);

            customer.GetAll();
            customer.GetById("ALFKI");
        }
Esempio n. 2
0
        public void TestGetAll()
        {
            IDataMapper r =
                new ReflectDataMapper(typeof(Category), NORTHWIND);

            Console.WriteLine(r.GetAll());
        }
Esempio n. 3
0
        public static void CustomerReflect()
        {
            IDataMapper test   = new ReflectDataMapper(typeof(Customer), connStr, true);
            IEnumerable res    = test.GetAll();
            object      id     = test.Insert(insertTestC);
            Customer    actual = (Customer)test.GetById(id);

            test.Delete(actual);
            Customer original = (Customer)test.GetById("ALFKI");

            test.Update(updateTestC);
            test.Update(original);
        }
Esempio n. 4
0
        public static void EmployeeReflect()
        {
            IDataMapper test   = new ReflectDataMapper(typeof(Employee), connStr, true);
            object      id     = test.Insert(tester);
            IEnumerable res    = test.GetAll();
            Employee    actual = (Employee)test.GetById(id);

            test.Delete(actual);
            Employee original = (Employee)test.GetById(1);

            test.Update(tester);
            test.Update(original);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            //Action emit = new Action(MeasureEmit);
            //Action reflect = new Action(MeasureReflect);
            //Action hardCoded = new Action(MeasureHardCoded);

            ////NBench.Bench(emit, "Emit Mapper");
            //NBench.Bench(reflect, "Reflect Mapper");
            ////NBench.Bench(hardCoded, "HardCoded Mapper");

            ReflectDataMapper <int, Employee> dm = new ReflectDataMapper <int, Employee>(typeof(Employee), connStr);

            IEnumerable <Employee> l2 = dm.GetAll();
        }
Esempio n. 6
0
        private static void CompareMappers(Type klass)
        {
            Console.WriteLine("############## Reflect WITH Cache");
            IDataMapper emps = new ReflectDataMapper(klass, connStr);

            for (int i = 0; i < 5; i++)
            {
                GetAllItens(emps);
            }

            Console.WriteLine("############## Reflect NO Cache");
            emps = new ReflectDataMapper(klass, connStr, false);
            for (int i = 0; i < 5; i++)
            {
                GetAllItens(emps);
            }
        }
Esempio n. 7
0
        public static void ProductReflect()
        {
            IDataMapper test       = new ReflectDataMapper(typeof(Product), connStr, true);
            IDataMapper categories = new ReflectDataMapper(typeof(Category), connStr, true);
            IDataMapper suppliers  = new ReflectDataMapper(typeof(Supplier), connStr, true);
            IEnumerable res        = test.GetAll();
            Category    c          = (Category)categories.GetById(4);
            Supplier    s          = (Supplier)suppliers.GetById(17);

            object  id     = test.Insert(ProductBuilder(c, s));
            Product actual = (Product)test.GetById(id);

            test.Delete(actual);

            Product original = (Product)test.GetById(10);

            c = (Category)categories.GetById(4);
            s = (Supplier)suppliers.GetById(17);


            test.Update(ProductBuilder(c, s));
            test.Update(original);
        }