private static string ObjectQueryTest()
        {
            var     resultList  = new List <decimal>();
            decimal testresults = 0;
            var     sw          = new System.Diagnostics.Stopwatch();
            var     sw2         = new System.Diagnostics.Stopwatch();

            for (int i = 0; i < 2; i++)
            {
                //sw.Reset();
                //sw.Start();
                resultList.Clear();
                var context = new AWEntities(); //<--been moving this in and out of the next for loop
                for (int j = 0; j < 100; j++)
                {
                    sw2.Reset();
                    sw2.Start();


                    //iterating is about the same time as tolist
                    var customers = context.CreateQuery <Customer>("Customers").ToList();
                    sw2.Stop();
                    resultList.Add(sw2.ElapsedMilliseconds);
                }
                //sw.Stop();

                testresults = sw.ElapsedMilliseconds;
            }
            Console.WriteLine("obj query 1:{0}", resultList[0]);
            Console.WriteLine("obj query 2:{0}", resultList[1]);
            Console.WriteLine("obj query 3:{0}", resultList[2]);
            return(String.Format("ObjectQuery: {0}ms", testresults));
        }
        private static void ExecuteQueryLoop(AWEntities oContext, AWL2SDataContext dContext, List <decimal> resultList, QueryType qType, int LoopCount)
        {
            var compQuery = CompiledQuery.Compile <AWEntities, IQueryable <AWCustomer> >
                                ((AWEntities ctx ) =>
                                from c in ctx.AWCustomers select c);


            for (int j = 0; j < LoopCount; j++)
            {
                var sw2 = new System.Diagnostics.Stopwatch();
                sw2.Start();
                //------------using compiled query
                // var customers = compQuery.Invoke(context);

                //iterating is about the same time as tolist
                switch (qType)
                {
                case QueryType.L2E:
                    // oContext = new AWEntities();
                    oContext.AWCustomers.MergeOption = MergeOption.OverwriteChanges;
                    var customers = (from c in oContext.AWCustomers select c).ToList();
                    break;

                case QueryType.EntityObject:
                    //  oContext = new AWEntities();
                    oContext.AWCustomers.MergeOption = MergeOption.OverwriteChanges;
                    var oqCusts = oContext.CreateQuery <AWCustomer>("AWCustomers").ToList();
                    break;

                case QueryType.L2S:
                    var l2SCusts = (from c in dContext.L2SCustomers select c).ToList();
                    break;

                case QueryType.CompiledL2E:
                    var compCusts = compQuery.Invoke(oContext).ToList();

                    break;

                case QueryType.DataReader:
                    break;

                default:
                    throw new ArgumentOutOfRangeException("qType");
                }
                sw2.Stop();
                resultList.Add(sw2.ElapsedMilliseconds);
            }
        }