I want to modify some Controllers for which i need to add few more parameters to the Constructor of the Controller. If I add more parameters, it won't work. Can you please suggest where do I need to map the parameters (for ioc) so that it works fine?
Controller Constructor Parameters
#1
Posted 31 March 2014 - 19:37
#2
Posted 31 March 2014 - 20:43
Objects auto resolved by autofac needs to be registered in \Presentation\SmartStore.Web.Framework\DependencyRegistrar.cs.
Marcus Gesing
Smartstore AG
#3
Posted 01 April 2014 - 05:19
Thanks for the reply. Can you please share some code or any example?
#4
Posted 01 April 2014 - 05:31
here is the original store controller -
After modification, it should look like -
#5
Posted 01 April 2014 - 14:18
private readonly IStoreService _storeService; private readonly ISettingService _settingService; private readonly ILocalizationService _localizationService; private readonly IPermissionService _permissionService; private readonly ILocationService _locationService; private readonly ICountryService _countryService; private readonly IStateProvinceService _stateProvinceService; public StoreController(IStoreService storeService, ISettingService settingService, ILocalizationService localizationService, IPermissionService permissionService, ILocationService locationService, ICountryService countryService, IStateProvinceService stateProvinceService) { this._storeService = storeService; this._settingService = settingService; this._localizationService = localizationService; this._permissionService = permissionService; this._locationService = locationService; this._countryService = countryService; this._stateProvinceService = stateProvinceService; }
ILocationService is unknown (not a build in service), so it needs to be registered as described above.
Marcus Gesing
Smartstore AG
#6
Posted 01 April 2014 - 18:57
thanks, finally, I am able to make it work
Also tagged with one or more of these keywords: IOC, Autofac, Controller, Constructor
Smartstore (English) →
Customize & Extend Smartstore →
Calling a controller function for a plugin controller not workStarted by Wlady , 26 Feb 2020 plugin, controller and 1 more... |
|
|
||
Smartstore (English) →
General Smartstore →
Circular component dependency detectedStarted by Sherif Ahmed , 13 Mar 2019 Autofac |
|
|
||
Smartstore (English) →
Customize & Extend Smartstore →
Extending ProjectStarted by Aaron Jones , 12 Feb 2016 Model, Extending, Controller and 1 more... |
|
|