Skip to content

Instantly share code, notes, and snippets.

View jean-lourenco's full-sized avatar
📦
resolving binding redirects

Jean Lourenço jean-lourenco

📦
resolving binding redirects
View GitHub Profile
@jean-lourenco
jean-lourenco / IHostedInterface.cs
Created September 28, 2020 16:34
Interface básica no IHostedService
public class ContractUpdated : IHostedService
{
public Task StartAsync(CancellationToken token)
{
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken token)
{
return Task.CompletedTask;
@jean-lourenco
jean-lourenco / di.cs
Created September 28, 2020 16:35
Linha para adicionar serviço no DI
services.AddHostedService<TimedHostedService>();
@jean-lourenco
jean-lourenco / timer.cs
Created September 28, 2020 16:46
IHostedService com Timer
public class ContractUpdated : IHostedService, IDisposible
{
private Timer _timer;
public Task StartAsync(CancellationToken token)
{
_timer = new Timer(
UpdateContracts,
null,
TimeSpan.Zero,