{"action":"created","comment":{"url":"https://api.github.com/repos/OData/WebApi/pulls/comments/41951149","id":41951149,"diff_hunk":"@@ -36,16 +42,120 @@ private static void InitDLManagers()\n             }\n         }\n \n-        [EnableQuery(MaxExpansionDepth = 3)]\n-        public IHttpActionResult Get()\n+        public IHttpActionResult Get(ODataQueryOptions<DLManager> queryOptions)\n         {\n-            return Ok(_DLManagers.AsQueryable());\n+            ODataValidationSettings settings = new ODataValidationSettings();\n+            settings.MaxExpansionDepth = 1;\n+\n+            try\n+            {\n+                queryOptions.Validate(settings);\n+            }\n+            catch (ODataException e)\n+            {\n+                var responseMessage = new HttpResponseMessage(HttpStatusCode.BadRequest);\n+                responseMessage.Content = new StringContent(\n+                    String.Format(\"The query specified in the URI is not valid. {0}\", e.Message));\n+                return ResponseMessage(responseMessage);\n+            }\n+\n+            var managers = queryOptions.ApplyTo(_DLManagers.AsQueryable()).AsQueryable();\n+            return Ok(managers, managers.GetType());\n         }\n \n         [EnableQuery(MaxExpansionDepth = 4)]\n         public IHttpActionResult Get(int key)\n         {\n             return Ok(_DLManagers.Single(e => e.ID == key));\n+\n+        }\n+\n+        private IHttpActionResult Ok(object content, Type type)\n+        {\n+            var resultType = typeof(OkNegotiatedContentResult<>).MakeGenericType(type);\n+            return Activator.CreateInstance(resultType, content, this) as IHttpActionResult;\n+        }\n+    }\n+\n+    public class DLEmployeesController : ODataController\n+    {\n+        public DLEmployeesController()\n+        {\n+            if (null == _DLEmployees)\n+            {\n+                InitDLEmployees();\n+            }\n+        }\n+\n+        private static List<DLEmployee> _DLEmployees = null;\n+\n+        private static void InitDLEmployees()\n+        {\n+            _DLEmployees = Enumerable.Range(1, 5).Select(i =>\n+                        new DLEmployee\n+                        {\n+                            ID = i,\n+                        }).ToList();\n+\n+            for (int i = 1; i < 4; i++)\n+            {\n+                _DLEmployees[i].Friend = _DLEmployees[i + 1];","path":"OData/test/E2ETest/WebStack.QA.Test.OData/DollarLevels/DollarLevelsController.cs","position":86,"original_position":86,"commit_id":"ebd2f6101042d758079f93e5a330e6d9751fc054","original_commit_id":"ebd2f6101042d758079f93e5a330e6d9751fc054","user":{"login":"xuzhg","id":9426627,"avatar_url":"https://avatars.githubusercontent.com/u/9426627?v=3","gravatar_id":"","url":"https://api.github.com/users/xuzhg","html_url":"https://github.com/xuzhg","followers_url":"https://api.github.com/users/xuzhg/followers","following_url":"https://api.github.com/users/xuzhg/following{/other_user}","gists_url":"https://api.github.com/users/xuzhg/gists{/gist_id}","starred_url":"https://api.github.com/users/xuzhg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xuzhg/subscriptions","organizations_url":"https://api.github.com/users/xuzhg/orgs","repos_url":"https://api.github.com/users/xuzhg/repos","events_url":"https://api.github.com/users/xuzhg/events{/privacy}","received_events_url":"https://api.github.com/users/xuzhg/received_events","type":"User","site_admin":false},"body":"what about the item #  0","created_at":"2015-10-14T03:11:21Z","updated_at":"2015-10-14T03:11:21Z","html_url":"https://github.com/OData/WebApi/pull/524#discussion_r41951149","pull_request_url":"https://api.github.com/repos/OData/WebApi/pulls/524","_links":{"self":{"href":"https://api.github.com/repos/OData/WebApi/pulls/comments/41951149"},"html":{"href":"https://github.com/OData/WebApi/pull/524#discussion_r41951149"},"pull_request":{"href":"https://api.github.com/repos/OData/WebApi/pulls/524"}}},"pull_request":{"url":"https://api.github.com/repos/OData/WebApi/pulls/524","id":47387947,"html_url":"https://github.com/OData/WebApi/pull/524","diff_url":"https://github.com/OData/WebApi/pull/524.diff","patch_url":"https://github.com/OData/WebApi/pull/524.patch","issue_url":"https://api.github.com/repos/OData/WebApi/issues/524","number":524,"state":"open","locked":false,"title":"Manually using ODataQueryOptions.Validate and setting SelectExpandQue…","user":{"login":"luoyan0517","id":2330441,"avatar_url":"https://avatars.githubusercontent.com/u/2330441?v=3","gravatar_id":"","url":"https://api.github.com/users/luoyan0517","html_url":"https://github.com/luoyan0517","followers_url":"https://api.github.com/users/luoyan0517/followers","following_url":"https://api.github.com/users/luoyan0517/following{/other_user}","gists_url":"https://api.github.com/users/luoyan0517/gists{/gist_id}","starred_url":"https://api.github.com/users/luoyan0517/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luoyan0517/subscriptions","organizations_url":"https://api.github.com/users/luoyan0517/orgs","repos_url":"https://api.github.com/users/luoyan0517/repos","events_url":"https://api.github.com/users/luoyan0517/events{/privacy}","received_events_url":"https://api.github.com/users/luoyan0517/received_events","type":"User","site_admin":false},"body":"…ryOption.LevelsMaxLiteralExpansionDepth #516 \r\n\r\nAlthough SelectExpandQueryOption.LevelsMaxLiteralExpansionDepth is used to control the actual expansion depth for each request. Although it is for internal use, but it is public so we cannot remove it. In the fix, the value of LevelsMaxLiteralExpansionDepth can be set manually or it will be set automatically to ODataValidationSettings.MaxExpansionDepth.","created_at":"2015-10-12T06:10:07Z","updated_at":"2015-10-14T03:11:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dacb40fd2568994ee87ef45559386e46f8aa6ffb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OData/WebApi/pulls/524/commits","review_comments_url":"https://api.github.com/repos/OData/WebApi/pulls/524/comments","review_comment_url":"https://api.github.com/repos/OData/WebApi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OData/WebApi/issues/524/comments","statuses_url":"https://api.github.com/repos/OData/WebApi/statuses/ebd2f6101042d758079f93e5a330e6d9751fc054","head":{"label":"luoyan0517:master","ref":"master","sha":"ebd2f6101042d758079f93e5a330e6d9751fc054","user":{"login":"luoyan0517","id":2330441,"avatar_url":"https://avatars.githubusercontent.com/u/2330441?v=3","gravatar_id":"","url":"https://api.github.com/users/luoyan0517","html_url":"https://github.com/luoyan0517","followers_url":"https://api.github.com/users/luoyan0517/followers","following_url":"https://api.github.com/users/luoyan0517/following{/other_user}","gists_url":"https://api.github.com/users/luoyan0517/gists{/gist_id}","starred_url":"https://api.github.com/users/luoyan0517/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luoyan0517/subscriptions","organizations_url":"https://api.github.com/users/luoyan0517/orgs","repos_url":"https://api.github.com/users/luoyan0517/repos","events_url":"https://api.github.com/users/luoyan0517/events{/privacy}","received_events_url":"https://api.github.com/users/luoyan0517/received_events","type":"User","site_admin":false},"repo":{"id":31532025,"name":"WebApi","full_name":"luoyan0517/WebApi","owner":{"login":"luoyan0517","id":2330441,"avatar_url":"https://avatars.githubusercontent.com/u/2330441?v=3","gravatar_id":"","url":"https://api.github.com/users/luoyan0517","html_url":"https://github.com/luoyan0517","followers_url":"https://api.github.com/users/luoyan0517/followers","following_url":"https://api.github.com/users/luoyan0517/following{/other_user}","gists_url":"https://api.github.com/users/luoyan0517/gists{/gist_id}","starred_url":"https://api.github.com/users/luoyan0517/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luoyan0517/subscriptions","organizations_url":"https://api.github.com/users/luoyan0517/orgs","repos_url":"https://api.github.com/users/luoyan0517/repos","events_url":"https://api.github.com/users/luoyan0517/events{/privacy}","received_events_url":"https://api.github.com/users/luoyan0517/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/luoyan0517/WebApi","description":"OData Web API: A server library built upon ODataLib and WebApi","fork":true,"url":"https://api.github.com/repos/luoyan0517/WebApi","forks_url":"https://api.github.com/repos/luoyan0517/WebApi/forks","keys_url":"https://api.github.com/repos/luoyan0517/WebApi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luoyan0517/WebApi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luoyan0517/WebApi/teams","hooks_url":"https://api.github.com/repos/luoyan0517/WebApi/hooks","issue_events_url":"https://api.github.com/repos/luoyan0517/WebApi/issues/events{/number}","events_url":"https://api.github.com/repos/luoyan0517/WebApi/events","assignees_url":"https://api.github.com/repos/luoyan0517/WebApi/assignees{/user}","branches_url":"https://api.github.com/repos/luoyan0517/WebApi/branches{/branch}","tags_url":"https://api.github.com/repos/luoyan0517/WebApi/tags","blobs_url":"https://api.github.com/repos/luoyan0517/WebApi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luoyan0517/WebApi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luoyan0517/WebApi/git/refs{/sha}","trees_url":"https://api.github.com/repos/luoyan0517/WebApi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luoyan0517/WebApi/statuses/{sha}","languages_url":"https://api.github.com/repos/luoyan0517/WebApi/languages","stargazers_url":"https://api.github.com/repos/luoyan0517/WebApi/stargazers","contributors_url":"https://api.github.com/repos/luoyan0517/WebApi/contributors","subscribers_url":"https://api.github.com/repos/luoyan0517/WebApi/subscribers","subscription_url":"https://api.github.com/repos/luoyan0517/WebApi/subscription","commits_url":"https://api.github.com/repos/luoyan0517/WebApi/commits{/sha}","git_commits_url":"https://api.github.com/repos/luoyan0517/WebApi/git/commits{/sha}","comments_url":"https://api.github.com/repos/luoyan0517/WebApi/comments{/number}","issue_comment_url":"https://api.github.com/repos/luoyan0517/WebApi/issues/comments{/number}","contents_url":"https://api.github.com/repos/luoyan0517/WebApi/contents/{+path}","compare_url":"https://api.github.com/repos/luoyan0517/WebApi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luoyan0517/WebApi/merges","archive_url":"https://api.github.com/repos/luoyan0517/WebApi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luoyan0517/WebApi/downloads","issues_url":"https://api.github.com/repos/luoyan0517/WebApi/issues{/number}","pulls_url":"https://api.github.com/repos/luoyan0517/WebApi/pulls{/number}","milestones_url":"https://api.github.com/repos/luoyan0517/WebApi/milestones{/number}","notifications_url":"https://api.github.com/repos/luoyan0517/WebApi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luoyan0517/WebApi/labels{/name}","releases_url":"https://api.github.com/repos/luoyan0517/WebApi/releases{/id}","created_at":"2015-03-02T09:12:45Z","updated_at":"2015-04-20T06:17:18Z","pushed_at":"2015-10-12T05:56:13Z","git_url":"git://github.com/luoyan0517/WebApi.git","ssh_url":"git@github.com:luoyan0517/WebApi.git","clone_url":"https://github.com/luoyan0517/WebApi.git","svn_url":"https://github.com/luoyan0517/WebApi","homepage":"","size":11027,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OData:master","ref":"master","sha":"36d44c5b048573452d676f0b1c264989ef9c210d","user":{"login":"OData","id":916520,"avatar_url":"https://avatars.githubusercontent.com/u/916520?v=3","gravatar_id":"","url":"https://api.github.com/users/OData","html_url":"https://github.com/OData","followers_url":"https://api.github.com/users/OData/followers","following_url":"https://api.github.com/users/OData/following{/other_user}","gists_url":"https://api.github.com/users/OData/gists{/gist_id}","starred_url":"https://api.github.com/users/OData/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OData/subscriptions","organizations_url":"https://api.github.com/users/OData/orgs","repos_url":"https://api.github.com/users/OData/repos","events_url":"https://api.github.com/users/OData/events{/privacy}","received_events_url":"https://api.github.com/users/OData/received_events","type":"Organization","site_admin":false},"repo":{"id":28804670,"name":"WebApi","full_name":"OData/WebApi","owner":{"login":"OData","id":916520,"avatar_url":"https://avatars.githubusercontent.com/u/916520?v=3","gravatar_id":"","url":"https://api.github.com/users/OData","html_url":"https://github.com/OData","followers_url":"https://api.github.com/users/OData/followers","following_url":"https://api.github.com/users/OData/following{/other_user}","gists_url":"https://api.github.com/users/OData/gists{/gist_id}","starred_url":"https://api.github.com/users/OData/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OData/subscriptions","organizations_url":"https://api.github.com/users/OData/orgs","repos_url":"https://api.github.com/users/OData/repos","events_url":"https://api.github.com/users/OData/events{/privacy}","received_events_url":"https://api.github.com/users/OData/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OData/WebApi","description":"OData Web API: A server library built upon ODataLib and WebApi","fork":false,"url":"https://api.github.com/repos/OData/WebApi","forks_url":"https://api.github.com/repos/OData/WebApi/forks","keys_url":"https://api.github.com/repos/OData/WebApi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OData/WebApi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OData/WebApi/teams","hooks_url":"https://api.github.com/repos/OData/WebApi/hooks","issue_events_url":"https://api.github.com/repos/OData/WebApi/issues/events{/number}","events_url":"https://api.github.com/repos/OData/WebApi/events","assignees_url":"https://api.github.com/repos/OData/WebApi/assignees{/user}","branches_url":"https://api.github.com/repos/OData/WebApi/branches{/branch}","tags_url":"https://api.github.com/repos/OData/WebApi/tags","blobs_url":"https://api.github.com/repos/OData/WebApi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OData/WebApi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OData/WebApi/git/refs{/sha}","trees_url":"https://api.github.com/repos/OData/WebApi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OData/WebApi/statuses/{sha}","languages_url":"https://api.github.com/repos/OData/WebApi/languages","stargazers_url":"https://api.github.com/repos/OData/WebApi/stargazers","contributors_url":"https://api.github.com/repos/OData/WebApi/contributors","subscribers_url":"https://api.github.com/repos/OData/WebApi/subscribers","subscription_url":"https://api.github.com/repos/OData/WebApi/subscription","commits_url":"https://api.github.com/repos/OData/WebApi/commits{/sha}","git_commits_url":"https://api.github.com/repos/OData/WebApi/git/commits{/sha}","comments_url":"https://api.github.com/repos/OData/WebApi/comments{/number}","issue_comment_url":"https://api.github.com/repos/OData/WebApi/issues/comments{/number}","contents_url":"https://api.github.com/repos/OData/WebApi/contents/{+path}","compare_url":"https://api.github.com/repos/OData/WebApi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OData/WebApi/merges","archive_url":"https://api.github.com/repos/OData/WebApi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OData/WebApi/downloads","issues_url":"https://api.github.com/repos/OData/WebApi/issues{/number}","pulls_url":"https://api.github.com/repos/OData/WebApi/pulls{/number}","milestones_url":"https://api.github.com/repos/OData/WebApi/milestones{/number}","notifications_url":"https://api.github.com/repos/OData/WebApi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OData/WebApi/labels{/name}","releases_url":"https://api.github.com/repos/OData/WebApi/releases{/id}","created_at":"2015-01-05T08:50:51Z","updated_at":"2015-10-13T21:42:44Z","pushed_at":"2015-10-13T20:00:50Z","git_url":"git://github.com/OData/WebApi.git","ssh_url":"git@github.com:OData/WebApi.git","clone_url":"https://github.com/OData/WebApi.git","svn_url":"https://github.com/OData/WebApi","homepage":"http://odata.github.io/WebApi","size":27823,"stargazers_count":133,"watchers_count":133,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":75,"mirror_url":null,"open_issues_count":280,"forks":75,"open_issues":280,"watchers":133,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OData/WebApi/pulls/524"},"html":{"href":"https://github.com/OData/WebApi/pull/524"},"issue":{"href":"https://api.github.com/repos/OData/WebApi/issues/524"},"comments":{"href":"https://api.github.com/repos/OData/WebApi/issues/524/comments"},"review_comments":{"href":"https://api.github.com/repos/OData/WebApi/pulls/524/comments"},"review_comment":{"href":"https://api.github.com/repos/OData/WebApi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OData/WebApi/pulls/524/commits"},"statuses":{"href":"https://api.github.com/repos/OData/WebApi/statuses/ebd2f6101042d758079f93e5a330e6d9751fc054"}}}}