{"action":"closed","issue":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13564","repository_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore","labels_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13564/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13564/comments","events_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/13564/events","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/13564","id":368483089,"node_id":"MDU6SXNzdWUzNjg0ODMwODk=","number":13564,"title":"Redundant Add when using notification entites","user":{"login":"sjb-sjb","id":19149638,"node_id":"MDQ6VXNlcjE5MTQ5NjM4","avatar_url":"https://avatars2.githubusercontent.com/u/19149638?v=4","gravatar_id":"","url":"https://api.github.com/users/sjb-sjb","html_url":"https://github.com/sjb-sjb","followers_url":"https://api.github.com/users/sjb-sjb/followers","following_url":"https://api.github.com/users/sjb-sjb/following{/other_user}","gists_url":"https://api.github.com/users/sjb-sjb/gists{/gist_id}","starred_url":"https://api.github.com/users/sjb-sjb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjb-sjb/subscriptions","organizations_url":"https://api.github.com/users/sjb-sjb/orgs","repos_url":"https://api.github.com/users/sjb-sjb/repos","events_url":"https://api.github.com/users/sjb-sjb/events{/privacy}","received_events_url":"https://api.github.com/users/sjb-sjb/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-10T03:47:06Z","updated_at":"2018-10-10T17:52:21Z","closed_at":"2018-10-10T17:52:21Z","author_association":"NONE","body":"When I set a navigation property in a notification-tracking entity, the referenced (primary) entity is added to the context (resulting State is Added) even if the referenced entity already has a store-assigned primary key. \r\n\r\nI understand why the referenced entity needs to be added if the primary key has not been created (e.g. a long with value zero) because EF needs a unique pseudo-key until the first time the entity is stored (e.g. a negative temporary key assigned by EF). However EF still adds the entity even if there is a valid (e.g. positive) store-generated key. This results in an attempt to write the entity again to the database, which cannot be done since the primary key already exists.\r\n\r\nEF should not attach the entity to the context in this case. "}}
{"actor":{"display_login":"ajcvickers"}}