{"action":"created","comment":{"url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/comments/50401657","id":50401657,"diff_hunk":"@@ -178,6 +178,34 @@ public void InstanceRegisteredWith_InstancePerJob_IsDisposedOnScopeDisposal()\n         }\n \n         [TestMethod]\n+        public void InstancePerJob_RegisteredWithExtraTags_ResolvesForJobScope()\r\n+        {\r\n+            var alternateLifetimeScopeTag = new object();\r\n+            _builder.Register(c => new object()).As<object>()\r\n+               .InstancePerBackgroundJob(alternateLifetimeScopeTag);\n+            var activator = CreateActivator();\n+\n+            using (var scope = activator.BeginScope())\n+            {\n+                var instance = scope.Resolve(typeof(object));\n+            }\r\n+        }\n+\n+        [TestMethod]\n+        public void InstancePerJob_RegisteredWithExtraTags_ResolvesForAlternateScope()\r\n+        {\r\n+            var alternateLifetimeScopeTag = new object();\r\n+            _builder.Register(c => new object()).As<object>()\r\n+               .InstancePerBackgroundJob(alternateLifetimeScopeTag);\n+            var container = _builder.Build();\n+\n+            using (var scope = container.BeginLifetimeScope(alternateLifetimeScopeTag))\n+            {\n+                var instance = scope.Resolve(typeof(object));","path":"HangFire.Autofac.Tests/AutofacJobActivatorTests.cs","position":27,"original_position":27,"commit_id":"6058bb166dc1102f40d8498a856d4ed9ef19f633","original_commit_id":"6058bb166dc1102f40d8498a856d4ed9ef19f633","user":{"login":"chaoaretasty","id":1376088,"avatar_url":"https://avatars.githubusercontent.com/u/1376088?v=3","gravatar_id":"","url":"https://api.github.com/users/chaoaretasty","html_url":"https://github.com/chaoaretasty","followers_url":"https://api.github.com/users/chaoaretasty/followers","following_url":"https://api.github.com/users/chaoaretasty/following{/other_user}","gists_url":"https://api.github.com/users/chaoaretasty/gists{/gist_id}","starred_url":"https://api.github.com/users/chaoaretasty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaoaretasty/subscriptions","organizations_url":"https://api.github.com/users/chaoaretasty/orgs","repos_url":"https://api.github.com/users/chaoaretasty/repos","events_url":"https://api.github.com/users/chaoaretasty/events{/privacy}","received_events_url":"https://api.github.com/users/chaoaretasty/received_events","type":"User","site_admin":false},"body":"There's already tests that Hangfire.Autofac properly registers with its scope tag when needed and that the activator correctly instantiates new lifetime scopes. The only job of this change is to combine any incoming scope tags with hangfire's when registering, which is tested by being able to resolve from scopes of either lifetime and doesn't throw for a missing tag.\r\n\r\nI could add that test in too if you want but you're really writing tests for Autofac itself at that point that its lifetime scopes work as it claims..","created_at":"2016-01-21T13:45:56Z","updated_at":"2016-01-21T13:45:56Z","html_url":"https://github.com/HangfireIO/Hangfire.Autofac/pull/8#discussion_r50401657","pull_request_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/comments/50401657"},"html":{"href":"https://github.com/HangfireIO/Hangfire.Autofac/pull/8#discussion_r50401657"},"pull_request":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8","id":56377522,"html_url":"https://github.com/HangfireIO/Hangfire.Autofac/pull/8","diff_url":"https://github.com/HangfireIO/Hangfire.Autofac/pull/8.diff","patch_url":"https://github.com/HangfireIO/Hangfire.Autofac/pull/8.patch","issue_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/issues/8","number":8,"state":"open","locked":false,"title":"Allow combining lifetime scope tags","user":{"login":"chaoaretasty","id":1376088,"avatar_url":"https://avatars.githubusercontent.com/u/1376088?v=3","gravatar_id":"","url":"https://api.github.com/users/chaoaretasty","html_url":"https://github.com/chaoaretasty","followers_url":"https://api.github.com/users/chaoaretasty/followers","following_url":"https://api.github.com/users/chaoaretasty/following{/other_user}","gists_url":"https://api.github.com/users/chaoaretasty/gists{/gist_id}","starred_url":"https://api.github.com/users/chaoaretasty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaoaretasty/subscriptions","organizations_url":"https://api.github.com/users/chaoaretasty/orgs","repos_url":"https://api.github.com/users/chaoaretasty/repos","events_url":"https://api.github.com/users/chaoaretasty/events{/privacy}","received_events_url":"https://api.github.com/users/chaoaretasty/received_events","type":"User","site_admin":false},"body":"Autofac's lifetimeScope registration methods such as `InstancePerRequest` and `InstancePerMatchingLifetimeScope` take a `params object[] lifetimeScopeTags` at the end allowing easy combining of allowed scopes. I've added this parameter to `InstancePerBackgroundJob`.\r\n\r\nThis lets people call `InstancePerBackgroundJob(Autofac.Core.Lifetime.MatchingScopeLifetimeTags.RequestLifetimeScopeTag)` allowing for proper registration of a component for either webrequests or background jobs, as well as allowing people to bring in their own tags if needed.","created_at":"2016-01-18T18:34:21Z","updated_at":"2016-01-21T13:45:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3196416325720d83bdd641763e15299cb820103","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8/commits","review_comments_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8/comments","review_comment_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/issues/8/comments","statuses_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/statuses/6058bb166dc1102f40d8498a856d4ed9ef19f633","head":{"label":"chaoaretasty:patch-2","ref":"patch-2","sha":"6058bb166dc1102f40d8498a856d4ed9ef19f633","user":{"login":"chaoaretasty","id":1376088,"avatar_url":"https://avatars.githubusercontent.com/u/1376088?v=3","gravatar_id":"","url":"https://api.github.com/users/chaoaretasty","html_url":"https://github.com/chaoaretasty","followers_url":"https://api.github.com/users/chaoaretasty/followers","following_url":"https://api.github.com/users/chaoaretasty/following{/other_user}","gists_url":"https://api.github.com/users/chaoaretasty/gists{/gist_id}","starred_url":"https://api.github.com/users/chaoaretasty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaoaretasty/subscriptions","organizations_url":"https://api.github.com/users/chaoaretasty/orgs","repos_url":"https://api.github.com/users/chaoaretasty/repos","events_url":"https://api.github.com/users/chaoaretasty/events{/privacy}","received_events_url":"https://api.github.com/users/chaoaretasty/received_events","type":"User","site_admin":false},"repo":{"id":49893755,"name":"Hangfire.Autofac","full_name":"chaoaretasty/Hangfire.Autofac","owner":{"login":"chaoaretasty","id":1376088,"avatar_url":"https://avatars.githubusercontent.com/u/1376088?v=3","gravatar_id":"","url":"https://api.github.com/users/chaoaretasty","html_url":"https://github.com/chaoaretasty","followers_url":"https://api.github.com/users/chaoaretasty/followers","following_url":"https://api.github.com/users/chaoaretasty/following{/other_user}","gists_url":"https://api.github.com/users/chaoaretasty/gists{/gist_id}","starred_url":"https://api.github.com/users/chaoaretasty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chaoaretasty/subscriptions","organizations_url":"https://api.github.com/users/chaoaretasty/orgs","repos_url":"https://api.github.com/users/chaoaretasty/repos","events_url":"https://api.github.com/users/chaoaretasty/events{/privacy}","received_events_url":"https://api.github.com/users/chaoaretasty/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chaoaretasty/Hangfire.Autofac","description":"HangFire job activator based on Autofac IoC container","fork":true,"url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac","forks_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/forks","keys_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/teams","hooks_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/hooks","issue_events_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/issues/events{/number}","events_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/events","assignees_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/assignees{/user}","branches_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/branches{/branch}","tags_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/tags","blobs_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/git/refs{/sha}","trees_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/statuses/{sha}","languages_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/languages","stargazers_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/stargazers","contributors_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/contributors","subscribers_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/subscribers","subscription_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/subscription","commits_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/commits{/sha}","git_commits_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/git/commits{/sha}","comments_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/comments{/number}","issue_comment_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/issues/comments{/number}","contents_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/contents/{+path}","compare_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/merges","archive_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/downloads","issues_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/issues{/number}","pulls_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/pulls{/number}","milestones_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/milestones{/number}","notifications_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/labels{/name}","releases_url":"https://api.github.com/repos/chaoaretasty/Hangfire.Autofac/releases{/id}","created_at":"2016-01-18T17:44:23Z","updated_at":"2016-01-18T17:44:24Z","pushed_at":"2016-01-19T22:11:01Z","git_url":"git://github.com/chaoaretasty/Hangfire.Autofac.git","ssh_url":"git@github.com:chaoaretasty/Hangfire.Autofac.git","clone_url":"https://github.com/chaoaretasty/Hangfire.Autofac.git","svn_url":"https://github.com/chaoaretasty/Hangfire.Autofac","homepage":null,"size":511,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"HangfireIO:master","ref":"master","sha":"49b592b55c163ce3aa783124d5676e2b6a2aa9e3","user":{"login":"HangfireIO","id":7880472,"avatar_url":"https://avatars.githubusercontent.com/u/7880472?v=3","gravatar_id":"","url":"https://api.github.com/users/HangfireIO","html_url":"https://github.com/HangfireIO","followers_url":"https://api.github.com/users/HangfireIO/followers","following_url":"https://api.github.com/users/HangfireIO/following{/other_user}","gists_url":"https://api.github.com/users/HangfireIO/gists{/gist_id}","starred_url":"https://api.github.com/users/HangfireIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HangfireIO/subscriptions","organizations_url":"https://api.github.com/users/HangfireIO/orgs","repos_url":"https://api.github.com/users/HangfireIO/repos","events_url":"https://api.github.com/users/HangfireIO/events{/privacy}","received_events_url":"https://api.github.com/users/HangfireIO/received_events","type":"Organization","site_admin":false},"repo":{"id":18330189,"name":"Hangfire.Autofac","full_name":"HangfireIO/Hangfire.Autofac","owner":{"login":"HangfireIO","id":7880472,"avatar_url":"https://avatars.githubusercontent.com/u/7880472?v=3","gravatar_id":"","url":"https://api.github.com/users/HangfireIO","html_url":"https://github.com/HangfireIO","followers_url":"https://api.github.com/users/HangfireIO/followers","following_url":"https://api.github.com/users/HangfireIO/following{/other_user}","gists_url":"https://api.github.com/users/HangfireIO/gists{/gist_id}","starred_url":"https://api.github.com/users/HangfireIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HangfireIO/subscriptions","organizations_url":"https://api.github.com/users/HangfireIO/orgs","repos_url":"https://api.github.com/users/HangfireIO/repos","events_url":"https://api.github.com/users/HangfireIO/events{/privacy}","received_events_url":"https://api.github.com/users/HangfireIO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HangfireIO/Hangfire.Autofac","description":"HangFire job activator based on Autofac IoC container","fork":false,"url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac","forks_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/forks","keys_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/teams","hooks_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/hooks","issue_events_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/issues/events{/number}","events_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/events","assignees_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/assignees{/user}","branches_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/branches{/branch}","tags_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/tags","blobs_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/git/refs{/sha}","trees_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/statuses/{sha}","languages_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/languages","stargazers_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/stargazers","contributors_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/contributors","subscribers_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/subscribers","subscription_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/subscription","commits_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/commits{/sha}","git_commits_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/git/commits{/sha}","comments_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/comments{/number}","issue_comment_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/issues/comments{/number}","contents_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/contents/{+path}","compare_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/merges","archive_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/downloads","issues_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/issues{/number}","pulls_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls{/number}","milestones_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/milestones{/number}","notifications_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/labels{/name}","releases_url":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/releases{/id}","created_at":"2014-04-01T13:25:27Z","updated_at":"2015-12-31T19:58:01Z","pushed_at":"2016-01-19T22:11:02Z","git_url":"git://github.com/HangfireIO/Hangfire.Autofac.git","ssh_url":"git@github.com:HangfireIO/Hangfire.Autofac.git","clone_url":"https://github.com/HangfireIO/Hangfire.Autofac.git","svn_url":"https://github.com/HangfireIO/Hangfire.Autofac","homepage":null,"size":770,"stargazers_count":12,"watchers_count":12,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":1,"forks":12,"open_issues":1,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8"},"html":{"href":"https://github.com/HangfireIO/Hangfire.Autofac/pull/8"},"issue":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/issues/8"},"comments":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/HangfireIO/Hangfire.Autofac/statuses/6058bb166dc1102f40d8498a856d4ed9ef19f633"}}}}