我们在mvc项目中使用存储库模式。 但是我无法在石英作业中实施服务。 这是代码;
[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);
如果我编写了此代码,则作业不会触发。 我怎么能没有问题地调用attachmentService.GetMany?