重写nopCommerce控制器,并使用依赖注入填充参数
本文关键字:依赖 注入 填充 参数 nopCommerce 控制器 重写 | 更新日期: 2023-09-27 18:15:22
我想重写nopCommerce CheckoutController。这是我的代码:
public class TwoStepCheckoutController : Nop.Web.Controllers.CheckoutController
{
public TwoStepCheckoutController(IWorkContext workContext,
IStoreContext storeContext,
IStoreMappingService storeMappingService,
IShoppingCartService shoppingCartService,
ILocalizationService localizationService,
ITaxService taxService,
ICurrencyService currencyService,
IPriceFormatter priceFormatter,
IOrderProcessingService orderProcessingService,
ICustomerService customerService,
IGenericAttributeService genericAttributeService,
ICountryService countryService,
IStateProvinceService stateProvinceService,
IShippingService shippingService,
IPaymentService paymentService,
IPluginFinder pluginFinder,
IOrderTotalCalculationService orderTotalCalculationService,
IRewardPointService rewardPointService,
ILogger logger,
IOrderService orderService,
IWebHelper webHelper,
HttpContextBase httpContext,
IAddressAttributeParser addressAttributeParser,
IAddressAttributeService addressAttributeService,
IAddressAttributeFormatter addressAttributeFormatter,
OrderSettings orderSettings,
RewardPointsSettings rewardPointsSettings,
PaymentSettings paymentSettings,
ShippingSettings shippingSettings,
AddressSettings addressSettings,
TaxSettings taxSettings,
CustomerSettings customerSettings)
:base(storeContext,storeMappingService,shoppingCartService,localizationService,taxService,currencyService,
priceFormatter, orderProcessingService, customerService, genericAttributeService, countryService,
stateProvinceService, shoppingCartService, paymentService, pluginFinder, orderTotalCalculationService,
rewardPointService, logger, orderService, webHelper, httpContext, addressAttributeParser,
addressAttributeService, addressAttributeFormatter, orderSettings, rewardPointsSettings, paymentSettings,
shippingSettings, addressSettings, taxSettings, customerSettings
)
{
}
}
我有下一个bug。
如果我写public TwoStepCheckoutController(/*params*/):base(){}
-问题是下一个也许有人知道如何解决这个问题。
注:对于那些不了解nopCommerce的人:所有构造函数参数都是由自动依赖注入填充的。
罗马
base CheckoutController类没有无参数构造函数。这意味着你必须用参数调用该类的构造函数:
public TwoStepCheckoutController(/*params*/):base(/*params*/){}