This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
var serviceCollection = new ServiceCollection(); | |
serviceCollection.AddScoped<JsonConfigUpdater>(); | |
serviceCollection.AddScoped<JsonConfigUpdaterSettigns>(); | |
serviceCollection.AddSingleton<ConfigUpdaterManager>(); | |
var provider = serviceCollection.BuildServiceProvider(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
using System.Collections; | |
using System.Diagnostics.CodeAnalysis; | |
var appBuidler = Host.CreateApplicationBuilder(); | |
appBuidler.Services.AddKeyedSingleton<IService, Serivce1>("abc"); | |
appBuidler.Services.AddKeyedSingleton<IService, Serivce2>("def"); | |
appBuidler.Services.AddSingleton<Test>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
using System.Collections; | |
using System.Diagnostics.CodeAnalysis; | |
namespace CompanyName; | |
internal class Program | |
{ | |
private static void Main(string[] args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; | |
using System.Collections; | |
using System.Diagnostics.CodeAnalysis; | |
namespace CompanyName; | |
internal class Program | |
{ | |
private static void Main(string[] args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomLog : IDisposable, IAsyncDisposable | |
{ | |
StreamWriter _log; | |
Channel<string> _channel = Channel.CreateUnbounded<string>(); | |
Task _writer; | |
CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); | |
Timer _flusher; | |
SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); | |
public CustomLog(string logName) |