roma9806mail
roma9806mail

Reputation: 601

Overriding nopCommerce controller with ctor arguments filling with dependency injection

I want to override nopCommerce CheckoutController. This is my code:

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
             )
    {

    }
}

And i have next bug.

If I wrote public TwoStepCheckoutController(/*params*/):base(){} - Problem is next Maybe somebody know how to resolve this problem.

P.S. For those who don`t know nopCommerce : all constructor parameters are filling by autofac Dependency Injection.

Upvotes: 0

Views: 245

Answers (1)

mariann
mariann

Reputation: 456

Roma

base CheckoutController class doesn't have a parameterless constructor. It means you must call constructor of this class with parameters:

public TwoStepCheckoutController(/*params*/):base(/*params*/){}

Upvotes: 1

Related Questions