{"action":"opened","issue":{"url":"https://api.github.com/repos/npgsql/npgsql/issues/653","labels_url":"https://api.github.com/repos/npgsql/npgsql/issues/653/labels{/name}","comments_url":"https://api.github.com/repos/npgsql/npgsql/issues/653/comments","events_url":"https://api.github.com/repos/npgsql/npgsql/issues/653/events","html_url":"https://github.com/npgsql/npgsql/issues/653","id":91769277,"number":653,"title":"Primary Key not set","user":{"login":"branciat","id":6303230,"avatar_url":"https://avatars.githubusercontent.com/u/6303230?v=3","gravatar_id":"","url":"https://api.github.com/users/branciat","html_url":"https://github.com/branciat","followers_url":"https://api.github.com/users/branciat/followers","following_url":"https://api.github.com/users/branciat/following{/other_user}","gists_url":"https://api.github.com/users/branciat/gists{/gist_id}","starred_url":"https://api.github.com/users/branciat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/branciat/subscriptions","organizations_url":"https://api.github.com/users/branciat/orgs","repos_url":"https://api.github.com/users/branciat/repos","events_url":"https://api.github.com/users/branciat/events{/privacy}","received_events_url":"https://api.github.com/users/branciat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-29T10:40:42Z","updated_at":"2015-06-29T10:40:42Z","closed_at":null,"body":"Hi,\r\n\r\nIn the model code first, the Snapshot have the code below \r\n---\r\n builder\r\n                .Annotation(\"Npgsql:DefaultSequenceName\", \"DefaultSequence\")\r\n                .Annotation(\"Npgsql:Sequence:.DefaultSequence\", \"'DefaultSequence', '', '1', '10', '', '', 'Int64', 'False'\")\r\n                .Annotation(\"Npgsql:ValueGeneration\", \"Sequence\")\r\n                .Annotation(\"SqlServer:ValueGeneration\", \"Identity\");\r\n            \r\n            builder.Entity(\"Mediagral.Accounting.Models.BankCheck\", b =>\r\n                {\r\n                    b.Property<int>(\"Id\")\r\n                        .GenerateValueOnAdd()\r\n                        .StoreGeneratedPattern(StoreGeneratedPattern.Identity)\r\n                        .Annotation(\"Npgsql:ValueGeneration\", \"Default\");\r\n                    \r\n                    b.Property<decimal>(\"Amount\");\r\n                    \r\n                    b.Property<string>(\"Bank\");\r\n                    \r\n                    b.Property<DateTime>(\"FilingDate\");\r\n                    \r\n                    b.Property<string>(\"Infos\");\r\n                    \r\n                    b.Property<int?>(\"InvoiceId\");\r\n                    \r\n                    b.Property<DateTime>(\"ReceiptDate\");\r\n                    \r\n                    b.Property<string>(\"Shortname\");\r\n                    \r\n                    b.Key(\"Id\");\r\n                });\r\n---\r\nNow i have\r\n---\r\n builder\r\n                .Annotation(\"Npgsql:ValueGeneration\", \"Identity\")\r\n                .Annotation(\"SqlServer:ValueGeneration\", \"Identity\");\r\n\r\n            builder.Entity(\"Mediagral.Accounting.Models.BankCheck\", b =>\r\n                {\r\n                    b.Property<int>(\"Id\")\r\n                        .StoreGeneratedPattern(StoreGeneratedPattern.Identity);\r\n\r\n                    b.Property<decimal>(\"Amount\");\r\n\r\n                    b.Property<string>(\"Bank\");\r\n\r\n                    b.Property<DateTime>(\"FilingDate\");\r\n\r\n                    b.Property<string>(\"Infos\");\r\n\r\n                    b.Property<int?>(\"InvoiceId\");\r\n\r\n                    b.Property<DateTime>(\"ReceiptDate\");\r\n\r\n                    b.Property<string>(\"Shortname\");\r\n\r\n                    b.Key(\"Id\");\r\n                });\r\n---\r\nThe same thing for the file *.designer.cs create by the ef migration add command.\r\n\r\nIs this change that no longer generates primary keys when it add a new entity ?\r\n\r\nthe default value primary key is set to zero by the framework when an entity is created.\r\nSql Server is ok, id is changed when i add an entity and save the change.\r\nPostgres throw an exception that said \"Id\" is violated constraint primary key."}}