Scaffolding for new Scheduled Job for the BlackBoardDigestJob
This commit is contained in:
38
Server/Infrastructure/BlackBoardDigestJob.cs
Normal file
38
Server/Infrastructure/BlackBoardDigestJob.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Oqtane.Infrastructure;
|
||||
using Oqtane.Repository;
|
||||
|
||||
namespace SZUAbsolventenverein.Module.BlackBoard.Infrastructure
|
||||
{
|
||||
public class BlackBoardDigestJob : HostedServiceBase
|
||||
{
|
||||
// JobType = "SZUAbsolventenverein.Module.BlackBoard.Infrastructure, SZUAbsolventenverein.Module.BlackBoard.Server.Oqtane"
|
||||
|
||||
public BlackBoardDigestJob(IServiceScopeFactory serviceScopeFactory) : base(serviceScopeFactory)
|
||||
{
|
||||
Name = "BlackBoardDigestJob";
|
||||
Frequency = "m";
|
||||
Interval = 1;
|
||||
IsEnabled = false;
|
||||
}
|
||||
|
||||
public override Task<string> ExecuteJobAsync(IServiceProvider provider)
|
||||
{
|
||||
StringBuilder log = new StringBuilder();
|
||||
|
||||
var sites = provider.GetRequiredService<ISiteRepository>();
|
||||
|
||||
foreach (var site in sites.GetSites())
|
||||
{
|
||||
log.AppendLine(site.Name);
|
||||
}
|
||||
|
||||
return Task.FromResult(log.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user