Click here to Skip to main content
15,499,802 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
We are using repository pattern in our mvc project. But I'm unable to implement service in quartz jobs. Here is the code;

C#
[DisallowConcurrentExecution]
public class DeleteContentsJob : IJob
{
    private readonly IAttachmentService attachmentService;
    public DeleteContentsJob(IAttachmentService attachmentService)
    {
        this.attachmentService = attachmentService;
    }

  public void Execute(IJobExecutionContext context)
    {
       var contentFiles = attachmentService.GetMany(cz, content.Id);


If I wrote this code, job doesnt fire.
How can I call attachmentService.GetMany without problem?

What I have tried:

This implementation does not work.
Posted
Comments
F-ES Sitecore 19-Nov-18 5:23am    
Check the constructor is being called and attachmentService references your repository. If not then you might need to populate attachmentService explicitly using your IoC container which will have some way of resolving services, or use DependencyResolver if you've set that up correctly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900