{"action":"created","issue":{"url":"https://api.github.com/repos/nopSolutions/nopCommerce/issues/1754","repository_url":"https://api.github.com/repos/nopSolutions/nopCommerce","labels_url":"https://api.github.com/repos/nopSolutions/nopCommerce/issues/1754/labels{/name}","comments_url":"https://api.github.com/repos/nopSolutions/nopCommerce/issues/1754/comments","events_url":"https://api.github.com/repos/nopSolutions/nopCommerce/issues/1754/events","html_url":"https://github.com/nopSolutions/nopCommerce/issues/1754","id":177684146,"number":1754,"title":"Allow running AutoMapper configuration in plugins","user":{"login":"andrewlock","id":18755388,"avatar_url":"https://avatars.githubusercontent.com/u/18755388?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewlock","html_url":"https://github.com/andrewlock","followers_url":"https://api.github.com/users/andrewlock/followers","following_url":"https://api.github.com/users/andrewlock/following{/other_user}","gists_url":"https://api.github.com/users/andrewlock/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewlock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewlock/subscriptions","organizations_url":"https://api.github.com/users/andrewlock/orgs","repos_url":"https://api.github.com/users/andrewlock/repos","events_url":"https://api.github.com/users/andrewlock/events{/privacy}","received_events_url":"https://api.github.com/users/andrewlock/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nopSolutions/nopCommerce/labels/discussion%20/%20investigation%20/%20rfc","name":"discussion / investigation / rfc","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"AndreiMaz","id":5019111,"avatar_url":"https://avatars.githubusercontent.com/u/5019111?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreiMaz","html_url":"https://github.com/AndreiMaz","followers_url":"https://api.github.com/users/AndreiMaz/followers","following_url":"https://api.github.com/users/AndreiMaz/following{/other_user}","gists_url":"https://api.github.com/users/AndreiMaz/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreiMaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreiMaz/subscriptions","organizations_url":"https://api.github.com/users/AndreiMaz/orgs","repos_url":"https://api.github.com/users/AndreiMaz/repos","events_url":"https://api.github.com/users/AndreiMaz/events{/privacy}","received_events_url":"https://api.github.com/users/AndreiMaz/received_events","type":"User","site_admin":false},"assignees":[{"login":"AndreiMaz","id":5019111,"avatar_url":"https://avatars.githubusercontent.com/u/5019111?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreiMaz","html_url":"https://github.com/AndreiMaz","followers_url":"https://api.github.com/users/AndreiMaz/followers","following_url":"https://api.github.com/users/AndreiMaz/following{/other_user}","gists_url":"https://api.github.com/users/AndreiMaz/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreiMaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreiMaz/subscriptions","organizations_url":"https://api.github.com/users/AndreiMaz/orgs","repos_url":"https://api.github.com/users/AndreiMaz/repos","events_url":"https://api.github.com/users/AndreiMaz/events{/privacy}","received_events_url":"https://api.github.com/users/AndreiMaz/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/nopSolutions/nopCommerce/milestones/2","html_url":"https://github.com/nopSolutions/nopCommerce/milestones/Version%203.90","labels_url":"https://api.github.com/repos/nopSolutions/nopCommerce/milestones/2/labels","id":1503910,"number":2,"title":"Version 3.90","description":"","creator":{"login":"AndreiMaz","id":5019111,"avatar_url":"https://avatars.githubusercontent.com/u/5019111?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreiMaz","html_url":"https://github.com/AndreiMaz","followers_url":"https://api.github.com/users/AndreiMaz/followers","following_url":"https://api.github.com/users/AndreiMaz/following{/other_user}","gists_url":"https://api.github.com/users/AndreiMaz/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreiMaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreiMaz/subscriptions","organizations_url":"https://api.github.com/users/AndreiMaz/orgs","repos_url":"https://api.github.com/users/AndreiMaz/repos","events_url":"https://api.github.com/users/AndreiMaz/events{/privacy}","received_events_url":"https://api.github.com/users/AndreiMaz/received_events","type":"User","site_admin":false},"open_issues":222,"closed_issues":50,"state":"open","created_at":"2016-01-13T08:34:12Z","updated_at":"2016-09-19T12:03:32Z","due_on":"2017-01-31T21:00:00Z","closed_at":null},"comments":4,"created_at":"2016-09-18T23:18:02Z","updated_at":"2016-09-19T12:05:28Z","closed_at":null,"body":"**Summary**\r\n\r\nWe need a way to configure `AutoMapper` in plugins. I propose to push `AutoMapperConfiguration` into Nop.Core and add an `AddConfiguration()` method.\r\n\r\n**Explanation**\r\n\r\nI have just been working through upgrading our nopcommerce plugins from 3.70 to 3.80 and have run into one significant issue.\r\n\r\nPreviously, we were using AutoMapper extensively to map our Entities to ViewModels etc. We ran the configuration code in an `IStartupTask` that would do all the appropriate `CreateMap` calls which worked smoothly. \r\n\r\nIn the latest upgrade to AutoMapper 5.0, as I'm sure you realise, the static Mapper interface has been replaced with an instance method, and has a requirement for all configuration to be performed as part of a single initialisation method.\r\n\r\nCurrently you have a `IStartupTask` that performs all the configuration in the Nop.Admin project by calling `AutoMapperConfiguration.Init()`. Somehow we need a decoupled way of providing additional configuration to the `AutoMapperConfiguration.Init` method.\r\n\r\nThere's a number of ways this could work, but one possibility would be to push the static `AutoMapperConfiguration` class down the project stack and into Nop.Core. It could have a public collection of configuration methods that `IStartupTasks` can add to, or better still an `AddConfiguration(Action<IMapperConfigurationAction> configureAction)` method that pushes into a private list. \r\n\r\nYou could then call `AutoMapperConfiguration.Init()` in `NopEngine.Initialize()` once all `IStartupTasks` have run, which will create a new `MapperConfiguration` using  the provided configActions, and call `CreateMapper()`.\r\n\r\nIt still feels a little messy, but I think it's possibly the cleanest solution? \r\n\r\nI'm happy to put together a pull request if you agree."},"comment":{"url":"https://api.github.com/repos/nopSolutions/nopCommerce/issues/comments/247975293","html_url":"https://github.com/nopSolutions/nopCommerce/issues/1754#issuecomment-247975293","issue_url":"https://api.github.com/repos/nopSolutions/nopCommerce/issues/1754","id":247975293,"user":{"login":"AndreiMaz","id":5019111,"avatar_url":"https://avatars.githubusercontent.com/u/5019111?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreiMaz","html_url":"https://github.com/AndreiMaz","followers_url":"https://api.github.com/users/AndreiMaz/followers","following_url":"https://api.github.com/users/AndreiMaz/following{/other_user}","gists_url":"https://api.github.com/users/AndreiMaz/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreiMaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreiMaz/subscriptions","organizations_url":"https://api.github.com/users/AndreiMaz/orgs","repos_url":"https://api.github.com/users/AndreiMaz/repos","events_url":"https://api.github.com/users/AndreiMaz/events{/privacy}","received_events_url":"https://api.github.com/users/AndreiMaz/received_events","type":"User","site_admin":false},"created_at":"2016-09-19T12:05:28Z","updated_at":"2016-09-19T12:05:28Z","body":"Contribution https://github.com/nopSolutions/nopCommerce/pull/1756"}}
{"actor":{"display_login":"AndreiMaz"}}