예제 #1
0
        public async virtual Task Execute <T, TResult>(QueryParameters <T, TResult> parameters)
        {
            IList fromOe = await ExecuteOe <T, TResult>(parameters.Expression, parameters.PageSize);

            List <IncludeVisitor.Include> includes = GetIncludes(parameters.Expression);

            if (typeof(TResult) == typeof(Object))
            {
                fromOe = TestHelper.ToOpenType(fromOe);
            }

            IList fromDb;

            using (var dataContext = OrderContext.Create(_databaseName))
            {
                fromDb = TestHelper.ExecuteDb <T, TResult>(dataContext, parameters.Expression, out IReadOnlyList <IncludeVisitor.Include> includesDb);
                includes.AddRange(includesDb);
            }

            TestHelper.Compare(fromDb, fromOe, includes);
        }
예제 #2
0
        public async virtual Task Execute <T, TResult>(QueryParameters <T, TResult> parameters)
        {
            IList fromOe;

            try
            {
                fromOe = await ExecuteOe <T, TResult>(parameters.Expression, parameters.PageSize);
            }
            catch (NotSupportedException e)
            {
                if (parameters.RequestUri.Contains("$apply="))
                {
                    throw;
                }

                fromOe = await ExecuteOeViaHttpClient(parameters);

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine(e.Message);
                Console.ResetColor();
            }

            List <IncludeVisitor.Include> includes = GetIncludes(DataAdapter, parameters.Expression);

            if (typeof(TResult) == typeof(Object))
            {
                fromOe = TestHelper.ToOpenType(fromOe);
            }

            IList fromDb;

            using (var dataContext = new OrderContext(OrderContextOptions.Create(true, null)))
            {
                fromDb = TestHelper.ExecuteDb(DataAdapter, dataContext, parameters.Expression, out IReadOnlyList <IncludeVisitor.Include> includesDb);
                includes.AddRange(includesDb);
            }

            TestHelper.Compare(fromDb, fromOe, DataAdapter.EntitySetAdapters.EdmModelMetadataProvider, includes);
        }