Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 897 Bytes

README.md

File metadata and controls

28 lines (22 loc) · 897 Bytes

HostedService Extension for .NET

NuGet Badge NuGet Badge

var builder = Host.CreateApplicationBuilder(args);

// TCP Server
builder.Services.AddTcpServer(options =>
{
    options.ListenAnyIP<SampleHandler>(18888);
});
builder.Services.AddSingleton<ICommand, ExitCommand>();
builder.Services.AddSingleton<ICommand, GetCommand>();
builder.Services.AddSingleton<ICommand, SetCommand>();

// Cron Job
builder.Services.AddJobScheduler(options =>
{
    options.UseJob<SampleJob>("*/1 * * * *");
});

// Service
builder.Services.AddSingleton<FeatureService>();

builder.Build().Run();