{"action":"created","issue":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/268","repository_url":"https://api.github.com/repos/simpleinjector/SimpleInjector","labels_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/268/labels{/name}","comments_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/268/comments","events_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/268/events","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/268","id":165531985,"number":268,"title":"Crosswiring ASP.NET Identity Core","user":{"login":"janhartmann","id":1107383,"avatar_url":"https://avatars.githubusercontent.com/u/1107383?v=3","gravatar_id":"","url":"https://api.github.com/users/janhartmann","html_url":"https://github.com/janhartmann","followers_url":"https://api.github.com/users/janhartmann/followers","following_url":"https://api.github.com/users/janhartmann/following{/other_user}","gists_url":"https://api.github.com/users/janhartmann/gists{/gist_id}","starred_url":"https://api.github.com/users/janhartmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janhartmann/subscriptions","organizations_url":"https://api.github.com/users/janhartmann/orgs","repos_url":"https://api.github.com/users/janhartmann/repos","events_url":"https://api.github.com/users/janhartmann/events{/privacy}","received_events_url":"https://api.github.com/users/janhartmann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-14T10:46:58Z","updated_at":"2016-07-14T12:45:18Z","closed_at":null,"body":"I'm trying to get myself going with ASP.NET Identity Core + .NET DI + Simple Injector and I (unfortunately) have to cross wire a lot of .NET services since I wish to use Simple Injector as my application DI library. I've been following the various blog posts around the state of .NET DI and I hope everything will work out in the end.\r\n\r\nI have a lot of services, which is wired like:\r\n\r\n```cs\r\n_container.RegisterCommands(typeof(MyHandlerAssembly).GetTypeInfo().Assembly);\r\n_container.RegisterQueries(typeof(MyHandlerAssembly).GetTypeInfo().Assembly);\r\n\r\n...\t\t\t\r\n\t\t\r\n// Cross wiring\r\n_container.Register(app.ApplicationServices.GetService<UserManager<MyUser>>, Lifestyle.Singleton);\r\n_container.Register(app.ApplicationServices.GetService<RoleManager<IdentityRole>>, Lifestyle.Singleton);\r\n_container.Register(app.ApplicationServices.GetService<SignInManager<MyUser>>, Lifestyle.Singleton);\r\n_container.Register(() => new MyDbContext(new DbContextOptionsBuilder().UseSqlServer(_configuration.GetConnectionString(\"Default\")).Options), Lifestyle.Scoped);\r\n          \r\n_container.Verify();\r\n```\r\n\r\nSimple Injector throws me this when verifying:\r\n\r\n> The configuration is invalid. Creating the instance for type `RoleManager<IdentityRole>` failed. The registered delegate for type `RoleManager<IdentityRole>` threw an exception. The registered delegate for type `RoleManager<IdentityRole>` returned null.\r\n\r\nHow can I register the  `RoleManager<IdentityRole>`like I do with the `UserManager<MyUser>`, which works fine?\r\n\r\nJan\r\n"},"comment":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/comments/232655062","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/268#issuecomment-232655062","issue_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/268","id":232655062,"user":{"login":"janhartmann","id":1107383,"avatar_url":"https://avatars.githubusercontent.com/u/1107383?v=3","gravatar_id":"","url":"https://api.github.com/users/janhartmann","html_url":"https://github.com/janhartmann","followers_url":"https://api.github.com/users/janhartmann/followers","following_url":"https://api.github.com/users/janhartmann/following{/other_user}","gists_url":"https://api.github.com/users/janhartmann/gists{/gist_id}","starred_url":"https://api.github.com/users/janhartmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janhartmann/subscriptions","organizations_url":"https://api.github.com/users/janhartmann/orgs","repos_url":"https://api.github.com/users/janhartmann/repos","events_url":"https://api.github.com/users/janhartmann/events{/privacy}","received_events_url":"https://api.github.com/users/janhartmann/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T12:45:18Z","updated_at":"2016-07-14T12:45:18Z","body":"The issue is still herefixed - still returns null when accessing the `HttpContext` property. The `HttpContextAccessor` is set as the instance of `IHttpContextAccessor` when debugging. "}}
{"actor":{"display_login":"janhartmann"}}