public HomeController(IGuidServiceTransient guidServiceTransient, IGuidServiceSingleton guidServiceSingleton, IGuidServiceScoped guidServiceScoped, ILogger <HomeController> logger) { _guidServiceTransient = guidServiceTransient; _guidServiceSingleton = guidServiceSingleton; _guidServiceScoped = guidServiceScoped; _logger = logger; }
public async Task InvokeAsync(HttpContext context, IGuidServiceTransient _guidServiceTransient, IGuidServiceSingleton _guidServiceSingleton, IGuidServiceScoped _guidServiceScoped) { var logMessage = $"Middleware: The Guid from GuidServiceTransient is {_guidServiceTransient.GetGuid()}" + $"The Guid from GuidServiceSingleton is {_guidServiceSingleton.GetGuid()}" + $"The Guid from GuidServiceScoped is {_guidServiceScoped.GetGuid()}"; _logger.LogInformation(logMessage); context.Items.Add("MiddlewareGuid", logMessage); await Task.WhenAll(_next(context)); }
public DIdemoController( IGuidServiceTransient guidServiceTransient, IGuidServiceScoped guidServiceScoped, // IGuidServiceTransient guidServiceTransientDup, // IGuidServiceScoped guidServiceScopedDup) IGuidServiceSingleton guidServiceSingleton, IGuidServiceSingletonInstance guidServiceSingletonInstance ) { this._guidServiceTransient = guidServiceTransient; this._guidServiceScoped = guidServiceScoped; // this._guidServiceTransientDup = guidServiceTransientDup; // this._guidServiceScopedDup = guidServiceScopedDup; this._guidServiceSingleton = guidServiceSingleton; this._guidServiceSingletonInstance = guidServiceSingletonInstance; }