예제 #1
0
        private static void MeasureReflect()
        {
            ReflectDataMapper <string, Customer> customer = new ReflectDataMapper <string, Customer>(typeof(Customer), connStr, false);

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

            Console.WriteLine(r.GetAll());
        }
예제 #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);
        }
예제 #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);
        }
예제 #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();
        }
예제 #6
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);
        }