{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2951","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2951/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2951/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2951/events","html_url":"https://github.com/aspnet/EntityFramework/issues/2951","id":103711469,"number":2951,"title":"EF7 bug with zero value in primary key column","user":{"login":"tstar","id":3426008,"avatar_url":"https://avatars.githubusercontent.com/u/3426008?v=3","gravatar_id":"","url":"https://api.github.com/users/tstar","html_url":"https://github.com/tstar","followers_url":"https://api.github.com/users/tstar/followers","following_url":"https://api.github.com/users/tstar/following{/other_user}","gists_url":"https://api.github.com/users/tstar/gists{/gist_id}","starred_url":"https://api.github.com/users/tstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tstar/subscriptions","organizations_url":"https://api.github.com/users/tstar/orgs","repos_url":"https://api.github.com/users/tstar/repos","events_url":"https://api.github.com/users/tstar/events{/privacy}","received_events_url":"https://api.github.com/users/tstar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/pri0","name":"pri0","color":"e11d21"}],"state":"closed","locked":false,"assignee":{"login":"anpete","id":1210944,"avatar_url":"https://avatars.githubusercontent.com/u/1210944?v=3","gravatar_id":"","url":"https://api.github.com/users/anpete","html_url":"https://github.com/anpete","followers_url":"https://api.github.com/users/anpete/followers","following_url":"https://api.github.com/users/anpete/following{/other_user}","gists_url":"https://api.github.com/users/anpete/gists{/gist_id}","starred_url":"https://api.github.com/users/anpete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anpete/subscriptions","organizations_url":"https://api.github.com/users/anpete/orgs","repos_url":"https://api.github.com/users/anpete/repos","events_url":"https://api.github.com/users/anpete/events{/privacy}","received_events_url":"https://api.github.com/users/anpete/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/7","html_url":"https://github.com/aspnet/EntityFramework/milestones/7.0.0","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/7/labels","id":666128,"number":7,"title":"7.0.0","description":"","creator":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"open_issues":210,"closed_issues":11,"state":"open","created_at":"2014-05-21T19:25:32Z","updated_at":"2015-09-03T18:42:58Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2015-08-28T12:33:50Z","updated_at":"2015-09-04T18:03:49Z","closed_at":"2015-09-03T18:42:58Z","body":"I have simple table Test with one column Age (int) with primary key on this column.\r\n```\r\nCREATE TABLE [dbo].[Test](\r\n\t[Age] [int] NOT NULL,\r\n\tCONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED ([Age] ASC)\r\nWITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY])\r\nON [PRIMARY]\r\n```\r\nMy table has 2 values (0, 1).\r\nAlso I have model for this table\r\n```\r\nmodelBuilder.Entity<Test_Entity>(x =>\r\n{\r\n\tx.ToTable(\"Test\", \"dbo\");\r\n\tx.Key(i => i.Age);\r\n});\r\n\r\npublic DbSet<Test_Entity> Test { get; set; }\r\n\r\npublic class Test_Entity\r\n{\r\n\tpublic int Age { get; set; }\r\n}\r\n\r\n```\r\nI need read all data to array like:\r\n```\r\nvar result = Test.ToArray();\r\n```\r\nIn result I am waiting something like:\r\n```\r\n[0] | { Age = 0 }\r\n[1] | { Age = 1 }\r\n```\r\nBut in fact I have:\r\n```\r\n[0] | null\r\n[1] | { Age = 1 }\r\n```\r\nIn Beta 2 this tests runs well. But in Beta 5, 6, 7, 8 I have this error.\r\n\r\nMy previous report about this problem https://github.com/aspnet/EntityFramework/issues/2117"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/137807489","html_url":"https://github.com/aspnet/EntityFramework/issues/2951#issuecomment-137807489","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/2951","id":137807489,"user":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T18:03:49Z","updated_at":"2015-09-04T18:03:49Z","body":"I think even aside from resources, an O/RM does not expose every piece of functionality available in the database. We pick the scenarios that make sense for the application patterns we are trying to enable.\r\n\r\nWhile I can't say I've ever seen a bool PK in a real world app, I do think maybe we need a way to disable the sentinel value for non generated keys (perhaps achieved internally just by setting it something the property will never be, such as `null`). That way we always just try and save whatever you give us and it's up to the developer to ensure they are unique before adding. It would enable this bool scenario but more importantly it would be an easy way to opt out for folks who know they always want to specify values."}}