Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Using dependency injection for my sheduled jobs?

$
0
0

I stumbled upon some article mentioning it being possible to use dependency injection for scheduled jobs - great! But using the ScheduledPlugin attribute is dependent an Execute method which is static. How am I suppose to reach my instance member from the static method?

    [ScheduledPlugIn(GUID = "7CFBA546-6015-43C7-94AB-FB73DCF8A960")]
    public class CustomJob
    {
        private readonly IContentLoader _contentLoader;
        public CustomJob(IContentLoader contentLoader)
        {
            _contentLoader = contentLoader;
        }
        public static string Execute()
        {
            // How can I reach my _contentLoader?
        }
    }

Viewing all articles
Browse latest Browse all 9076

Trending Articles