Newsbot.Collector/Newsbot.Collector.Services/Jobs/HelloWorldJob.cs

30 lines
552 B
C#
Raw Normal View History

2023-02-14 17:51:22 -08:00
using Microsoft.Extensions.Configuration;
2023-02-14 17:51:22 -08:00
namespace Newsbot.Collector.Services.Jobs;
public class HelloWorldJobOptions
2023-02-14 17:51:22 -08:00
{
public string Message { get; set; } = "";
}
2023-02-14 17:51:22 -08:00
public class HelloWorldJob
{
private HelloWorldJobOptions _options;
public HelloWorldJob(HelloWorldJobOptions options)
2023-02-14 17:51:22 -08:00
{
_options = options;
2023-02-14 17:51:22 -08:00
}
public void InitAndExecute(HelloWorldJobOptions options)
{
_options = options;
Execute();
}
private void Execute()
2023-02-14 17:51:22 -08:00
{
Console.WriteLine(_options.Message);
2023-02-14 17:51:22 -08:00
}
}