{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments/27232042","id":27232042,"diff_hunk":"@@ -1049,5 +1066,42 @@ public int Compare(IReadOnlyList<Property> x, IReadOnlyList<Property> y)\n                 return result;\n             }\n         }\n+\n+        private class PropertyComparer : IComparer<string>\n+        {\n+            private readonly EntityType _entityType;\n+\n+            public PropertyComparer(EntityType entityType)\n+            {\n+                _entityType = entityType;\n+            }\n+\n+            public int Compare(string x, string y)\n+            {\n+                var properties = _entityType.FindPrimaryKey()?.Properties.Select(p => p.Name).ToList();\n+\n+                if (properties != null)\n+                {\n+                    var xIndex = properties.IndexOf(x);\n+                    var yIndex = properties.IndexOf(y);\n+\n+                    if (xIndex != -1 && yIndex != -1)\n+                    {\n+                        return xIndex - yIndex;\n+                    }\n+                    else\n+                    if (xIndex != -1)\n+                    {\n+                        return -1;\n+                    }\n+                    else if (yIndex != -1)\n+                    {\n+                        return 1;\n+                    }","path":"src/EntityFramework.Core/Metadata/EntityType.cs","position":349,"original_position":349,"commit_id":"34886cce2d367f171f89ffc8f3bd7ca3fd41d054","original_commit_id":"34886cce2d367f171f89ffc8f3bd7ca3fd41d054","user":{"login":"ajcvickers","id":1430078,"avatar_url":"https://avatars.githubusercontent.com/u/1430078?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false},"body":"Consider conditional operator.","created_at":"2015-03-26T16:54:10Z","updated_at":"2015-03-26T16:54:10Z","html_url":"https://github.com/aspnet/EntityFramework/pull/1896#discussion_r27232042","pull_request_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896","_links":{"self":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments/27232042"},"html":{"href":"https://github.com/aspnet/EntityFramework/pull/1896#discussion_r27232042"},"pull_request":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896","id":31881300,"html_url":"https://github.com/aspnet/EntityFramework/pull/1896","diff_url":"https://github.com/aspnet/EntityFramework/pull/1896.diff","patch_url":"https://github.com/aspnet/EntityFramework/pull/1896.patch","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/1896","number":1896,"state":"open","locked":false,"title":"(WIP) EntityType properties ordered by primary key members first","user":{"login":"mikary","id":6787717,"avatar_url":"https://avatars.githubusercontent.com/u/6787717?v=3","gravatar_id":"","url":"https://api.github.com/users/mikary","html_url":"https://github.com/mikary","followers_url":"https://api.github.com/users/mikary/followers","following_url":"https://api.github.com/users/mikary/following{/other_user}","gists_url":"https://api.github.com/users/mikary/gists{/gist_id}","starred_url":"https://api.github.com/users/mikary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikary/subscriptions","organizations_url":"https://api.github.com/users/mikary/orgs","repos_url":"https://api.github.com/users/mikary/repos","events_url":"https://api.github.com/users/mikary/events{/privacy}","received_events_url":"https://api.github.com/users/mikary/received_events","type":"User","site_admin":false},"body":"First commit removes ```LazyRef``` from the ```EntityType``` collection members as we discussed.\r\nSecond commit uses new ```IComparer<T>``` to order properties and adds tests\r\n\r\nThis solution makes the logic for ```SetPrimaryKey``` a bit strange because changes to the PK value impact the comparer behavior and the ```SortedDictionary``` assumes the contents are sorted when performing other operations (i.e. Remove).\r\n\r\nThe ```CompiledModel``` tests are broken by this change due to the property order in KoolModel.cs no longer being correct. Is this test model generated, or will the corrections need to be made by hand?\r\n\r\n@ajcvickers @divega ","created_at":"2015-03-24T23:43:17Z","updated_at":"2015-03-26T16:54:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14fda90467f184c5f6343866d6f1e3fd93496dc6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896/commits","review_comments_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896/comments","review_comment_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/1896/comments","statuses_url":"https://api.github.com/repos/aspnet/EntityFramework/statuses/34886cce2d367f171f89ffc8f3bd7ca3fd41d054","head":{"label":"aspnet:entityTypePropertyOrder","ref":"entityTypePropertyOrder","sha":"34886cce2d367f171f89ffc8f3bd7ca3fd41d054","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16157746,"name":"EntityFramework","full_name":"aspnet/EntityFramework","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/EntityFramework","description":"Microsoft's recommended data access technology for new applications in .NET.","fork":false,"url":"https://api.github.com/repos/aspnet/EntityFramework","forks_url":"https://api.github.com/repos/aspnet/EntityFramework/forks","keys_url":"https://api.github.com/repos/aspnet/EntityFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/EntityFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/EntityFramework/teams","hooks_url":"https://api.github.com/repos/aspnet/EntityFramework/hooks","issue_events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/EntityFramework/events","assignees_url":"https://api.github.com/repos/aspnet/EntityFramework/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/EntityFramework/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/EntityFramework/tags","blobs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/EntityFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/EntityFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/EntityFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/EntityFramework/languages","stargazers_url":"https://api.github.com/repos/aspnet/EntityFramework/stargazers","contributors_url":"https://api.github.com/repos/aspnet/EntityFramework/contributors","subscribers_url":"https://api.github.com/repos/aspnet/EntityFramework/subscribers","subscription_url":"https://api.github.com/repos/aspnet/EntityFramework/subscription","commits_url":"https://api.github.com/repos/aspnet/EntityFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/EntityFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/EntityFramework/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/EntityFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/EntityFramework/merges","archive_url":"https://api.github.com/repos/aspnet/EntityFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/EntityFramework/downloads","issues_url":"https://api.github.com/repos/aspnet/EntityFramework/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/EntityFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/EntityFramework/releases{/id}","created_at":"2014-01-23T00:52:01Z","updated_at":"2015-03-26T13:16:12Z","pushed_at":"2015-03-25T23:32:26Z","git_url":"git://github.com/aspnet/EntityFramework.git","ssh_url":"git@github.com:aspnet/EntityFramework.git","clone_url":"https://github.com/aspnet/EntityFramework.git","svn_url":"https://github.com/aspnet/EntityFramework","homepage":"","size":54758,"stargazers_count":1466,"watchers_count":1466,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":384,"mirror_url":null,"open_issues_count":359,"forks":384,"open_issues":359,"watchers":1466,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"4a432ad7473688d6ff75566daa6d1efd40e03fb0","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16157746,"name":"EntityFramework","full_name":"aspnet/EntityFramework","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/EntityFramework","description":"Microsoft's recommended data access technology for new applications in .NET.","fork":false,"url":"https://api.github.com/repos/aspnet/EntityFramework","forks_url":"https://api.github.com/repos/aspnet/EntityFramework/forks","keys_url":"https://api.github.com/repos/aspnet/EntityFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/EntityFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/EntityFramework/teams","hooks_url":"https://api.github.com/repos/aspnet/EntityFramework/hooks","issue_events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/EntityFramework/events","assignees_url":"https://api.github.com/repos/aspnet/EntityFramework/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/EntityFramework/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/EntityFramework/tags","blobs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/EntityFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/EntityFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/EntityFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/EntityFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/EntityFramework/languages","stargazers_url":"https://api.github.com/repos/aspnet/EntityFramework/stargazers","contributors_url":"https://api.github.com/repos/aspnet/EntityFramework/contributors","subscribers_url":"https://api.github.com/repos/aspnet/EntityFramework/subscribers","subscription_url":"https://api.github.com/repos/aspnet/EntityFramework/subscription","commits_url":"https://api.github.com/repos/aspnet/EntityFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/EntityFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/EntityFramework/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/EntityFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/EntityFramework/merges","archive_url":"https://api.github.com/repos/aspnet/EntityFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/EntityFramework/downloads","issues_url":"https://api.github.com/repos/aspnet/EntityFramework/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/EntityFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/EntityFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/EntityFramework/releases{/id}","created_at":"2014-01-23T00:52:01Z","updated_at":"2015-03-26T13:16:12Z","pushed_at":"2015-03-25T23:32:26Z","git_url":"git://github.com/aspnet/EntityFramework.git","ssh_url":"git@github.com:aspnet/EntityFramework.git","clone_url":"https://github.com/aspnet/EntityFramework.git","svn_url":"https://github.com/aspnet/EntityFramework","homepage":"","size":54758,"stargazers_count":1466,"watchers_count":1466,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":384,"mirror_url":null,"open_issues_count":359,"forks":384,"open_issues":359,"watchers":1466,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896"},"html":{"href":"https://github.com/aspnet/EntityFramework/pull/1896"},"issue":{"href":"https://api.github.com/repos/aspnet/EntityFramework/issues/1896"},"comments":{"href":"https://api.github.com/repos/aspnet/EntityFramework/issues/1896/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/EntityFramework/pulls/1896/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/EntityFramework/statuses/34886cce2d367f171f89ffc8f3bd7ca3fd41d054"}}}}