{"action":"created","issue":{"url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2732","repository_url":"https://api.github.com/repos/OrchardCMS/OrchardCore","labels_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2732/labels{/name}","comments_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2732/comments","events_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2732/events","html_url":"https://github.com/OrchardCMS/OrchardCore/issues/2732","id":383939301,"node_id":"MDU6SXNzdWUzODM5MzkzMDE=","number":2732,"title":"Auto-registration of dependencies","user":{"login":"Piedone","id":1976647,"node_id":"MDQ6VXNlcjE5NzY2NDc=","avatar_url":"https://avatars3.githubusercontent.com/u/1976647?v=4","gravatar_id":"","url":"https://api.github.com/users/Piedone","html_url":"https://github.com/Piedone","followers_url":"https://api.github.com/users/Piedone/followers","following_url":"https://api.github.com/users/Piedone/following{/other_user}","gists_url":"https://api.github.com/users/Piedone/gists{/gist_id}","starred_url":"https://api.github.com/users/Piedone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Piedone/subscriptions","organizations_url":"https://api.github.com/users/Piedone/orgs","repos_url":"https://api.github.com/users/Piedone/repos","events_url":"https://api.github.com/users/Piedone/events{/privacy}","received_events_url":"https://api.github.com/users/Piedone/received_events","type":"User","site_admin":false},"labels":[{"id":492591198,"node_id":"MDU6TGFiZWw0OTI1OTExOTg=","url":"https://api.github.com/repos/OrchardCMS/OrchardCore/labels/discussion","name":"discussion","color":"fef2c0","default":false},{"id":149551461,"node_id":"MDU6TGFiZWwxNDk1NTE0NjE=","url":"https://api.github.com/repos/OrchardCMS/OrchardCore/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-23T23:03:55Z","updated_at":"2018-11-23T23:38:57Z","closed_at":null,"author_association":"MEMBER","body":"While the manual registration of dependencies in `Startup.cs` files is the usual thing in ASP.NET Core it's still additional work if you have many. We could have an optional feature to automatically register dependencies in the way Orchard requires them by default.\r\n\r\nThis would take care of dependency registrations if you don't want to do anything fancy, like developing a standard content part. So this feature would be aware of the usual Orchard types and not required changes to other parts of the framework. Dare I say we could have marker interfaces or something declarative for the three basic kinds of dependencies (scoped, transient, singleton) so you can get your custom dependencies auto-registered as well, O1-style.\r\n\r\nThis could happen from an extension method on `IServiceCollection` like described [here](https://www.thereformedprogrammer.net/asp-net-core-fast-and-automatic-dependency-injection-setup/). So it would scrape your extension only, if you want it. Obviously possible from a 3rd party library as well, but I thought I'd discuss the idea."},"comment":{"url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/comments/441330034","html_url":"https://github.com/OrchardCMS/OrchardCore/issues/2732#issuecomment-441330034","issue_url":"https://api.github.com/repos/OrchardCMS/OrchardCore/issues/2732","id":441330034,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTMzMDAzNA==","user":{"login":"Piedone","id":1976647,"node_id":"MDQ6VXNlcjE5NzY2NDc=","avatar_url":"https://avatars3.githubusercontent.com/u/1976647?v=4","gravatar_id":"","url":"https://api.github.com/users/Piedone","html_url":"https://github.com/Piedone","followers_url":"https://api.github.com/users/Piedone/followers","following_url":"https://api.github.com/users/Piedone/following{/other_user}","gists_url":"https://api.github.com/users/Piedone/gists{/gist_id}","starred_url":"https://api.github.com/users/Piedone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Piedone/subscriptions","organizations_url":"https://api.github.com/users/Piedone/orgs","repos_url":"https://api.github.com/users/Piedone/repos","events_url":"https://api.github.com/users/Piedone/events{/privacy}","received_events_url":"https://api.github.com/users/Piedone/received_events","type":"User","site_admin":false},"created_at":"2018-11-23T23:38:57Z","updated_at":"2018-11-23T23:38:57Z","author_association":"MEMBER","body":"For custom dependencies yeah, maybe it wouldn't add much. But the pain point is for all the cases where you already need to derive from an Orchard type (for content parts, drivers, migrations, background tasks for example).\r\n\r\nAnd as I described this wouldn't change what Startup classes are for, rather if you want in your module you could have a registration call there instead of one per each dependency."}}
{"actor":{"display_login":"Piedone"}}