{"action":"created","comment":{"url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/comments/205346133","pull_request_review_id":140595987,"id":205346133,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTM0NjEzMw==","diff_hunk":"@@ -31,12 +34,51 @@ public static void EnsureSeedData(IServiceProvider serviceProvider)\n             using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())\n             {\n                 var context = scope.ServiceProvider.GetRequiredService<AdminDbContext>();\n+                var userManager = scope.ServiceProvider.GetRequiredService<UserManager<UserIdentity>>();\n+                var roleManager = scope.ServiceProvider.GetRequiredService<RoleManager<UserIdentityRole>>();\n+\n                 context.Database.Migrate();\n-                EnsureSeedData(context);\n+                EnsureSeedIdentityServerData(context);\n+                EnsureSeedIdentityData(userManager, roleManager);\n+            }\n+        }\n+\n+        /// <summary>\n+        /// Generate default admin user / role\n+        /// </summary>\n+        private static void EnsureSeedIdentityData(UserManager<UserIdentity> userManager,\n+            RoleManager<UserIdentityRole> roleManager)\n+        {\n+            // Create admin role\n+            if (!roleManager.RoleExistsAsync(AuthorizationConsts.AdministrationRole).Result)\n+            {\n+                var role = new UserIdentityRole { Name = AuthorizationConsts.AdministrationRole };\n+\n+                roleManager.CreateAsync(role).Wait();","path":"src/Skoruba.IdentityServer4.Admin/Helpers/DbMigrationHelpers.cs","position":39,"original_position":39,"commit_id":"025cb0abd37c5db6db807304bc7e89824aa41026","original_commit_id":"025cb0abd37c5db6db807304bc7e89824aa41026","user":{"login":"skoruba","id":35664089,"node_id":"MDQ6VXNlcjM1NjY0MDg5","avatar_url":"https://avatars1.githubusercontent.com/u/35664089?v=4","gravatar_id":"","url":"https://api.github.com/users/skoruba","html_url":"https://github.com/skoruba","followers_url":"https://api.github.com/users/skoruba/followers","following_url":"https://api.github.com/users/skoruba/following{/other_user}","gists_url":"https://api.github.com/users/skoruba/gists{/gist_id}","starred_url":"https://api.github.com/users/skoruba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoruba/subscriptions","organizations_url":"https://api.github.com/users/skoruba/orgs","repos_url":"https://api.github.com/users/skoruba/repos","events_url":"https://api.github.com/users/skoruba/events{/privacy}","received_events_url":"https://api.github.com/users/skoruba/received_events","type":"User","site_admin":false},"body":"Great point! \r\nI am wondering about it as well. This method is executed in `Main` method from `Program.cs`. What do you recommend for this use case - try to rewrite it using async/await? I'm not sure how it will work. I've found similiar question on SO - https://stackoverflow.com/a/9212343/943403 - what do you think about it?","created_at":"2018-07-26T06:44:24Z","updated_at":"2018-07-26T06:44:24Z","html_url":"https://github.com/skoruba/IdentityServer4.Admin/pull/45#discussion_r205346133","pull_request_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/comments/205346133"},"html":{"href":"https://github.com/skoruba/IdentityServer4.Admin/pull/45#discussion_r205346133"},"pull_request":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45"}},"in_reply_to_id":205241795},"pull_request":{"url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45","id":203875226,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzODc1MjI2","html_url":"https://github.com/skoruba/IdentityServer4.Admin/pull/45","diff_url":"https://github.com/skoruba/IdentityServer4.Admin/pull/45.diff","patch_url":"https://github.com/skoruba/IdentityServer4.Admin/pull/45.patch","issue_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/45","number":45,"state":"open","locked":false,"title":"Update seed data with default admin account","user":{"login":"skoruba","id":35664089,"node_id":"MDQ6VXNlcjM1NjY0MDg5","avatar_url":"https://avatars1.githubusercontent.com/u/35664089?v=4","gravatar_id":"","url":"https://api.github.com/users/skoruba","html_url":"https://github.com/skoruba","followers_url":"https://api.github.com/users/skoruba/followers","following_url":"https://api.github.com/users/skoruba/following{/other_user}","gists_url":"https://api.github.com/users/skoruba/gists{/gist_id}","starred_url":"https://api.github.com/users/skoruba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoruba/subscriptions","organizations_url":"https://api.github.com/users/skoruba/orgs","repos_url":"https://api.github.com/users/skoruba/repos","events_url":"https://api.github.com/users/skoruba/events{/privacy}","received_events_url":"https://api.github.com/users/skoruba/received_events","type":"User","site_admin":false},"body":"Fix #44 ","created_at":"2018-07-25T15:24:57Z","updated_at":"2018-07-26T06:44:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e2fa2c62a928fd420ff34eff1d88b7264be52d7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45/commits","review_comments_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45/comments","review_comment_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/45/comments","statuses_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/statuses/025cb0abd37c5db6db807304bc7e89824aa41026","head":{"label":"skoruba:dev","ref":"dev","sha":"025cb0abd37c5db6db807304bc7e89824aa41026","user":{"login":"skoruba","id":35664089,"node_id":"MDQ6VXNlcjM1NjY0MDg5","avatar_url":"https://avatars1.githubusercontent.com/u/35664089?v=4","gravatar_id":"","url":"https://api.github.com/users/skoruba","html_url":"https://github.com/skoruba","followers_url":"https://api.github.com/users/skoruba/followers","following_url":"https://api.github.com/users/skoruba/following{/other_user}","gists_url":"https://api.github.com/users/skoruba/gists{/gist_id}","starred_url":"https://api.github.com/users/skoruba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoruba/subscriptions","organizations_url":"https://api.github.com/users/skoruba/orgs","repos_url":"https://api.github.com/users/skoruba/repos","events_url":"https://api.github.com/users/skoruba/events{/privacy}","received_events_url":"https://api.github.com/users/skoruba/received_events","type":"User","site_admin":false},"repo":{"id":121049045,"node_id":"MDEwOlJlcG9zaXRvcnkxMjEwNDkwNDU=","name":"IdentityServer4.Admin","full_name":"skoruba/IdentityServer4.Admin","owner":{"login":"skoruba","id":35664089,"node_id":"MDQ6VXNlcjM1NjY0MDg5","avatar_url":"https://avatars1.githubusercontent.com/u/35664089?v=4","gravatar_id":"","url":"https://api.github.com/users/skoruba","html_url":"https://github.com/skoruba","followers_url":"https://api.github.com/users/skoruba/followers","following_url":"https://api.github.com/users/skoruba/following{/other_user}","gists_url":"https://api.github.com/users/skoruba/gists{/gist_id}","starred_url":"https://api.github.com/users/skoruba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoruba/subscriptions","organizations_url":"https://api.github.com/users/skoruba/orgs","repos_url":"https://api.github.com/users/skoruba/repos","events_url":"https://api.github.com/users/skoruba/events{/privacy}","received_events_url":"https://api.github.com/users/skoruba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skoruba/IdentityServer4.Admin","description":"The administration for the IdentityServer4 and Asp.Net Core Identity","fork":false,"url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin","forks_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/forks","keys_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/teams","hooks_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/hooks","issue_events_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/events{/number}","events_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/events","assignees_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/assignees{/user}","branches_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/branches{/branch}","tags_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/tags","blobs_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/statuses/{sha}","languages_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/languages","stargazers_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/stargazers","contributors_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/contributors","subscribers_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/subscribers","subscription_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/subscription","commits_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/contents/{+path}","compare_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/merges","archive_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/downloads","issues_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues{/number}","pulls_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls{/number}","milestones_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/milestones{/number}","notifications_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/labels{/name}","releases_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/releases{/id}","deployments_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/deployments","created_at":"2018-02-10T19:56:05Z","updated_at":"2018-07-26T05:17:44Z","pushed_at":"2018-07-25T15:24:58Z","git_url":"git://github.com/skoruba/IdentityServer4.Admin.git","ssh_url":"git@github.com:skoruba/IdentityServer4.Admin.git","clone_url":"https://github.com/skoruba/IdentityServer4.Admin.git","svn_url":"https://github.com/skoruba/IdentityServer4.Admin","homepage":"","size":3084,"stargazers_count":50,"watchers_count":50,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":5,"watchers":50,"default_branch":"master"}},"base":{"label":"skoruba:master","ref":"master","sha":"492108c89a7034fc5f29fc233bf357778f64591f","user":{"login":"skoruba","id":35664089,"node_id":"MDQ6VXNlcjM1NjY0MDg5","avatar_url":"https://avatars1.githubusercontent.com/u/35664089?v=4","gravatar_id":"","url":"https://api.github.com/users/skoruba","html_url":"https://github.com/skoruba","followers_url":"https://api.github.com/users/skoruba/followers","following_url":"https://api.github.com/users/skoruba/following{/other_user}","gists_url":"https://api.github.com/users/skoruba/gists{/gist_id}","starred_url":"https://api.github.com/users/skoruba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoruba/subscriptions","organizations_url":"https://api.github.com/users/skoruba/orgs","repos_url":"https://api.github.com/users/skoruba/repos","events_url":"https://api.github.com/users/skoruba/events{/privacy}","received_events_url":"https://api.github.com/users/skoruba/received_events","type":"User","site_admin":false},"repo":{"id":121049045,"node_id":"MDEwOlJlcG9zaXRvcnkxMjEwNDkwNDU=","name":"IdentityServer4.Admin","full_name":"skoruba/IdentityServer4.Admin","owner":{"login":"skoruba","id":35664089,"node_id":"MDQ6VXNlcjM1NjY0MDg5","avatar_url":"https://avatars1.githubusercontent.com/u/35664089?v=4","gravatar_id":"","url":"https://api.github.com/users/skoruba","html_url":"https://github.com/skoruba","followers_url":"https://api.github.com/users/skoruba/followers","following_url":"https://api.github.com/users/skoruba/following{/other_user}","gists_url":"https://api.github.com/users/skoruba/gists{/gist_id}","starred_url":"https://api.github.com/users/skoruba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skoruba/subscriptions","organizations_url":"https://api.github.com/users/skoruba/orgs","repos_url":"https://api.github.com/users/skoruba/repos","events_url":"https://api.github.com/users/skoruba/events{/privacy}","received_events_url":"https://api.github.com/users/skoruba/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skoruba/IdentityServer4.Admin","description":"The administration for the IdentityServer4 and Asp.Net Core Identity","fork":false,"url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin","forks_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/forks","keys_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/teams","hooks_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/hooks","issue_events_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/events{/number}","events_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/events","assignees_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/assignees{/user}","branches_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/branches{/branch}","tags_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/tags","blobs_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/statuses/{sha}","languages_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/languages","stargazers_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/stargazers","contributors_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/contributors","subscribers_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/subscribers","subscription_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/subscription","commits_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/contents/{+path}","compare_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/merges","archive_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/downloads","issues_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues{/number}","pulls_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls{/number}","milestones_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/milestones{/number}","notifications_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/labels{/name}","releases_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/releases{/id}","deployments_url":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/deployments","created_at":"2018-02-10T19:56:05Z","updated_at":"2018-07-26T05:17:44Z","pushed_at":"2018-07-25T15:24:58Z","git_url":"git://github.com/skoruba/IdentityServer4.Admin.git","ssh_url":"git@github.com:skoruba/IdentityServer4.Admin.git","clone_url":"https://github.com/skoruba/IdentityServer4.Admin.git","svn_url":"https://github.com/skoruba/IdentityServer4.Admin","homepage":"","size":3084,"stargazers_count":50,"watchers_count":50,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":5,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45"},"html":{"href":"https://github.com/skoruba/IdentityServer4.Admin/pull/45"},"issue":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/45"},"comments":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/skoruba/IdentityServer4.Admin/statuses/025cb0abd37c5db6db807304bc7e89824aa41026"}},"author_association":"OWNER"}}
{"actor":{"display_login":"skoruba"}}