Need gudiance: how to create a scheduled task in a plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
Im trying to figure this out but im stuck right now and have no clue on how to get this to work:

Ive registered a job i the ScheduleTask Table setting the type as:
Nop.Plugin.Feed.Gs.Services.SynchronizationTask

In my plugin i have the SynchronizationTask.cs:

namespace Nop.Plugin.Feed.Gs.Services
{
    public class SynchronizationTask : IScheduleTask
    {
        #region Fields

        private readonly IStoreService _storeService;
        private readonly GSService _gsService;

        #endregion

        #region Ctor

        public SynchronizationTask(
            IStoreService storeService,
            GSService gsService
            )
        {
            this._storeService = storeService;
            this._gsService = gsService;
        }

        #endregion


        #region Method
        
        public void Execute()
        {
            foreach (var store in _storeService.GetAllStores())
               _gsService.GenerateStaticFile(store);
        }

        #endregion
    }
}



I was hoping this was enough, but clearly it isnt so. I get the Following Error message if i try and run the task:

No constructor was found that had all the dependencies satisfied

Can someone guide me in this issue?

Thanks!
4 years ago
Did you Register your type in a IDependencyRegistrar class?

What version of nopCommerce?
4 years ago
Ooops forgot, version 4.20.

I did not register my type. To be honest im not sure how to do that
4 years ago
Sorry for any inconvenience, i rebuilt the plugin and now it works.

Thanks for you input
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.