public long GetCustomerAndOrdersByEmp(int empID)
        {
            Stopwatch clock = new Stopwatch();

            clock.Start();
            List <Order> result;

            using (IDbConnection db = new SqlConnection(connString))
            {
                result = db.Query <Order, Employee, Customer, Order>(Constants.GET_ENTIRE_ORDER,
                                                                     (order, employee, customer) =>
                {
                    order.Employee = employee;
                    order.Customer = customer;
                    return(order);
                },
                                                                     new { EmployeeID = empID },
                                                                     splitOn: "EmployeeID, CustomerID").ToList();
            }
            clock.Stop();
            var elapsedTime = clock.ElapsedMilliseconds;

            ResultComparer.GetCustomerAndOrdersByEmp(result, method);

            return(elapsedTime);
        }
        public long GetCustomerAndOrdersByEmp(int empId)
        {
            Stopwatch clock = new Stopwatch();

            clock.Start();
            List <Order> result;

            using (NwEntityContext context = new NwEntityContext())
            {
                result = context.Orders.Include(x => x.Customer).Include(x => x.Customer).Include(x => x.Employee).Where(x => x.Employee.EmployeeID == empId).ToList();
            }
            clock.Stop();
            var elapsedTime = clock.ElapsedMilliseconds;

            ResultComparer.GetCustomerAndOrdersByEmp(result, method);

            return(elapsedTime);
        }
Пример #3
0
        public long GetCustomerAndOrdersByEmp(int empId)
        {
            Stopwatch clock = new Stopwatch();

            clock.Start();
            var query = from order in db.Orders
                        join customer in db.Customers on order.CustomerID equals customer.CustomerID
                        join employee in db.Employees on order.EmployeeID equals employee.EmployeeID
                        where employee.EmployeeID == empId
                        select order;

            query.ToList();
            clock.Stop();
            var elapsedTime = clock.ElapsedMilliseconds;

            ResultComparer.GetCustomerAndOrdersByEmp(query.ToList(), method);


            return(elapsedTime);
        }