{"action":"opened","number":3,"pull_request":{"url":"https://api.github.com/repos/khellang/EF.Interception/pulls/3","id":58696872,"html_url":"https://github.com/khellang/EF.Interception/pull/3","diff_url":"https://github.com/khellang/EF.Interception/pull/3.diff","patch_url":"https://github.com/khellang/EF.Interception/pull/3.patch","issue_url":"https://api.github.com/repos/khellang/EF.Interception/issues/3","number":3,"state":"open","locked":false,"title":"Solution for #2","user":{"login":"fagnercarvalho","id":817867,"avatar_url":"https://avatars.githubusercontent.com/u/817867?v=3","gravatar_id":"","url":"https://api.github.com/users/fagnercarvalho","html_url":"https://github.com/fagnercarvalho","followers_url":"https://api.github.com/users/fagnercarvalho/followers","following_url":"https://api.github.com/users/fagnercarvalho/following{/other_user}","gists_url":"https://api.github.com/users/fagnercarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/fagnercarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fagnercarvalho/subscriptions","organizations_url":"https://api.github.com/users/fagnercarvalho/orgs","repos_url":"https://api.github.com/users/fagnercarvalho/repos","events_url":"https://api.github.com/users/fagnercarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/fagnercarvalho/received_events","type":"User","site_admin":false},"body":"Solution for #2.\r\n\r\nI basically created the `BeforeState` property in the `EntityEntry` class so he can't be affected by the `Unchanged` state being applied by EF after calling the `SaveChanges()` method. The `BeforeState` property was then used as a criteria to filter only the implemented Post methods (`PostInsert`, `PostUpdate`, and `PostDelete`) as candidates for execution. \r\nBefore and after implementing the change I ran a test for confirm that this solution was working fine and also to see if I didn't break anything and everything was good: my newly created test failed before the change and succeeded after and all the tests run fine.\r\n\r\nI also had to install the `xunit.runner.console` package because the [xUnit.net VSIX is deprecated](http://xunit.github.io/docs/vsix-deprecated.html).\r\n\r\nJust one more thing. While I was implementing this solution I faced a problem. Which Post method should be executed if the `Delete` method was executed using EF but the `PreDelete` interceptor method changed the `EntityState` to `Modified`? `PostUpdate` or `PostDelete`? I chosen the second option, but I would like to hear opinions about that.","created_at":"2016-02-09T02:11:38Z","updated_at":"2016-02-09T02:11:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/khellang/EF.Interception/pulls/3/commits","review_comments_url":"https://api.github.com/repos/khellang/EF.Interception/pulls/3/comments","review_comment_url":"https://api.github.com/repos/khellang/EF.Interception/pulls/comments{/number}","comments_url":"https://api.github.com/repos/khellang/EF.Interception/issues/3/comments","statuses_url":"https://api.github.com/repos/khellang/EF.Interception/statuses/c394349fba25224edb6c2b09f3e16892ff01dff5","head":{"label":"fagnercarvalho:fix-post-methods-exec-adding-beforestate-property","ref":"fix-post-methods-exec-adding-beforestate-property","sha":"c394349fba25224edb6c2b09f3e16892ff01dff5","user":{"login":"fagnercarvalho","id":817867,"avatar_url":"https://avatars.githubusercontent.com/u/817867?v=3","gravatar_id":"","url":"https://api.github.com/users/fagnercarvalho","html_url":"https://github.com/fagnercarvalho","followers_url":"https://api.github.com/users/fagnercarvalho/followers","following_url":"https://api.github.com/users/fagnercarvalho/following{/other_user}","gists_url":"https://api.github.com/users/fagnercarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/fagnercarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fagnercarvalho/subscriptions","organizations_url":"https://api.github.com/users/fagnercarvalho/orgs","repos_url":"https://api.github.com/users/fagnercarvalho/repos","events_url":"https://api.github.com/users/fagnercarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/fagnercarvalho/received_events","type":"User","site_admin":false},"repo":{"id":51337892,"name":"EF.Interception","full_name":"fagnercarvalho/EF.Interception","owner":{"login":"fagnercarvalho","id":817867,"avatar_url":"https://avatars.githubusercontent.com/u/817867?v=3","gravatar_id":"","url":"https://api.github.com/users/fagnercarvalho","html_url":"https://github.com/fagnercarvalho","followers_url":"https://api.github.com/users/fagnercarvalho/followers","following_url":"https://api.github.com/users/fagnercarvalho/following{/other_user}","gists_url":"https://api.github.com/users/fagnercarvalho/gists{/gist_id}","starred_url":"https://api.github.com/users/fagnercarvalho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fagnercarvalho/subscriptions","organizations_url":"https://api.github.com/users/fagnercarvalho/orgs","repos_url":"https://api.github.com/users/fagnercarvalho/repos","events_url":"https://api.github.com/users/fagnercarvalho/events{/privacy}","received_events_url":"https://api.github.com/users/fagnercarvalho/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fagnercarvalho/EF.Interception","description":"A library for intercepting EntityFramework actions, like insert, update and delete.","fork":true,"url":"https://api.github.com/repos/fagnercarvalho/EF.Interception","forks_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/forks","keys_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/teams","hooks_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/hooks","issue_events_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/issues/events{/number}","events_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/events","assignees_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/assignees{/user}","branches_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/branches{/branch}","tags_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/tags","blobs_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/git/refs{/sha}","trees_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/statuses/{sha}","languages_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/languages","stargazers_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/stargazers","contributors_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/contributors","subscribers_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/subscribers","subscription_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/subscription","commits_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/commits{/sha}","git_commits_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/git/commits{/sha}","comments_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/comments{/number}","issue_comment_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/issues/comments{/number}","contents_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/contents/{+path}","compare_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/merges","archive_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/downloads","issues_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/issues{/number}","pulls_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/pulls{/number}","milestones_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/milestones{/number}","notifications_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/labels{/name}","releases_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/releases{/id}","deployments_url":"https://api.github.com/repos/fagnercarvalho/EF.Interception/deployments","created_at":"2016-02-09T00:36:58Z","updated_at":"2016-02-09T00:36:59Z","pushed_at":"2016-02-09T02:08:02Z","git_url":"git://github.com/fagnercarvalho/EF.Interception.git","ssh_url":"git@github.com:fagnercarvalho/EF.Interception.git","clone_url":"https://github.com/fagnercarvalho/EF.Interception.git","svn_url":"https://github.com/fagnercarvalho/EF.Interception","homepage":"","size":786,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"khellang:master","ref":"master","sha":"d9d87f9c5f23e0f6ad4eb4f7ce4448107afd1e16","user":{"login":"khellang","id":582487,"avatar_url":"https://avatars.githubusercontent.com/u/582487?v=3","gravatar_id":"","url":"https://api.github.com/users/khellang","html_url":"https://github.com/khellang","followers_url":"https://api.github.com/users/khellang/followers","following_url":"https://api.github.com/users/khellang/following{/other_user}","gists_url":"https://api.github.com/users/khellang/gists{/gist_id}","starred_url":"https://api.github.com/users/khellang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khellang/subscriptions","organizations_url":"https://api.github.com/users/khellang/orgs","repos_url":"https://api.github.com/users/khellang/repos","events_url":"https://api.github.com/users/khellang/events{/privacy}","received_events_url":"https://api.github.com/users/khellang/received_events","type":"User","site_admin":false},"repo":{"id":11843533,"name":"EF.Interception","full_name":"khellang/EF.Interception","owner":{"login":"khellang","id":582487,"avatar_url":"https://avatars.githubusercontent.com/u/582487?v=3","gravatar_id":"","url":"https://api.github.com/users/khellang","html_url":"https://github.com/khellang","followers_url":"https://api.github.com/users/khellang/followers","following_url":"https://api.github.com/users/khellang/following{/other_user}","gists_url":"https://api.github.com/users/khellang/gists{/gist_id}","starred_url":"https://api.github.com/users/khellang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khellang/subscriptions","organizations_url":"https://api.github.com/users/khellang/orgs","repos_url":"https://api.github.com/users/khellang/repos","events_url":"https://api.github.com/users/khellang/events{/privacy}","received_events_url":"https://api.github.com/users/khellang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/khellang/EF.Interception","description":"A library for intercepting EntityFramework actions, like insert, update and delete.","fork":false,"url":"https://api.github.com/repos/khellang/EF.Interception","forks_url":"https://api.github.com/repos/khellang/EF.Interception/forks","keys_url":"https://api.github.com/repos/khellang/EF.Interception/keys{/key_id}","collaborators_url":"https://api.github.com/repos/khellang/EF.Interception/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/khellang/EF.Interception/teams","hooks_url":"https://api.github.com/repos/khellang/EF.Interception/hooks","issue_events_url":"https://api.github.com/repos/khellang/EF.Interception/issues/events{/number}","events_url":"https://api.github.com/repos/khellang/EF.Interception/events","assignees_url":"https://api.github.com/repos/khellang/EF.Interception/assignees{/user}","branches_url":"https://api.github.com/repos/khellang/EF.Interception/branches{/branch}","tags_url":"https://api.github.com/repos/khellang/EF.Interception/tags","blobs_url":"https://api.github.com/repos/khellang/EF.Interception/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/khellang/EF.Interception/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/khellang/EF.Interception/git/refs{/sha}","trees_url":"https://api.github.com/repos/khellang/EF.Interception/git/trees{/sha}","statuses_url":"https://api.github.com/repos/khellang/EF.Interception/statuses/{sha}","languages_url":"https://api.github.com/repos/khellang/EF.Interception/languages","stargazers_url":"https://api.github.com/repos/khellang/EF.Interception/stargazers","contributors_url":"https://api.github.com/repos/khellang/EF.Interception/contributors","subscribers_url":"https://api.github.com/repos/khellang/EF.Interception/subscribers","subscription_url":"https://api.github.com/repos/khellang/EF.Interception/subscription","commits_url":"https://api.github.com/repos/khellang/EF.Interception/commits{/sha}","git_commits_url":"https://api.github.com/repos/khellang/EF.Interception/git/commits{/sha}","comments_url":"https://api.github.com/repos/khellang/EF.Interception/comments{/number}","issue_comment_url":"https://api.github.com/repos/khellang/EF.Interception/issues/comments{/number}","contents_url":"https://api.github.com/repos/khellang/EF.Interception/contents/{+path}","compare_url":"https://api.github.com/repos/khellang/EF.Interception/compare/{base}...{head}","merges_url":"https://api.github.com/repos/khellang/EF.Interception/merges","archive_url":"https://api.github.com/repos/khellang/EF.Interception/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/khellang/EF.Interception/downloads","issues_url":"https://api.github.com/repos/khellang/EF.Interception/issues{/number}","pulls_url":"https://api.github.com/repos/khellang/EF.Interception/pulls{/number}","milestones_url":"https://api.github.com/repos/khellang/EF.Interception/milestones{/number}","notifications_url":"https://api.github.com/repos/khellang/EF.Interception/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/khellang/EF.Interception/labels{/name}","releases_url":"https://api.github.com/repos/khellang/EF.Interception/releases{/id}","deployments_url":"https://api.github.com/repos/khellang/EF.Interception/deployments","created_at":"2013-08-02T13:06:48Z","updated_at":"2016-02-07T03:05:36Z","pushed_at":"2014-05-30T12:01:49Z","git_url":"git://github.com/khellang/EF.Interception.git","ssh_url":"git@github.com:khellang/EF.Interception.git","clone_url":"https://github.com/khellang/EF.Interception.git","svn_url":"https://github.com/khellang/EF.Interception","homepage":"","size":1005,"stargazers_count":10,"watchers_count":10,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/khellang/EF.Interception/pulls/3"},"html":{"href":"https://github.com/khellang/EF.Interception/pull/3"},"issue":{"href":"https://api.github.com/repos/khellang/EF.Interception/issues/3"},"comments":{"href":"https://api.github.com/repos/khellang/EF.Interception/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/khellang/EF.Interception/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/khellang/EF.Interception/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/khellang/EF.Interception/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/khellang/EF.Interception/statuses/c394349fba25224edb6c2b09f3e16892ff01dff5"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":3,"additions":61,"deletions":4,"changed_files":11}}