Override method in PictureService from a plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 11 ans
Hi
I want to override a couple of methods in the PictureService. I want to do it in a plugin.
So I added DependencyRegistrar in my plugin like so:

public class DependencyRegistrar : IDependencyRegistrar
    {
        public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder)
        {
            builder.RegisterType<Nop.Plugin.Misc.ImageNew.Services.PictureService>().As<IPictureService>().InstancePerHttpRequest();
        }

        public int Order
        {
            get { return 10; }
        }
    }


Now in my class Nop.Plugin.Misc.ImageNew.Services.PictureService I don't want to implement all the methods of IPictureService.  I want to implement only 2 of them and use all the old methods from the original PictureService.

How can this be done?
Thank you for your answers.
Lev
Il y a 11 ans
Simply inherit your Nop.Plugin.Misc.ImageNew.Services.PictureService from default Nop.Services.Media.PictureController and override required methods
Il y a 11 ans
Thank you it worked
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.