From 0420bddf0017c30128c01d9b38e2be1262f3f0c7 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Tue, 25 Apr 2023 12:43:24 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B0=D0=BD=D0=BD=D0=B0=D1=8F=20La?= =?UTF-8?q?bWork07.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BlacksmithWorkshopRestApi.csproj | 1 + .../BlackmithWorkshopRestApi/Program.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/BlacksmithWorkshop/BlackmithWorkshopRestApi/BlacksmithWorkshopRestApi.csproj b/BlacksmithWorkshop/BlackmithWorkshopRestApi/BlacksmithWorkshopRestApi.csproj index bd5dd6d..a54bb8c 100644 --- a/BlacksmithWorkshop/BlackmithWorkshopRestApi/BlacksmithWorkshopRestApi.csproj +++ b/BlacksmithWorkshop/BlackmithWorkshopRestApi/BlacksmithWorkshopRestApi.csproj @@ -13,6 +13,7 @@ + diff --git a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs index 6c39ddf..57c7f87 100644 --- a/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs +++ b/BlacksmithWorkshop/BlackmithWorkshopRestApi/Program.cs @@ -25,7 +25,7 @@ builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); -builder.Services.AddTransient(); +builder.Services.AddSingleton(); builder.Services.AddControllers(); @@ -44,12 +44,12 @@ var mailSender = app.Services.GetService(); mailSender?.MailConfig(new MailConfigBindingModel { - MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty, - MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty, - SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty, - SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()), - PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty, - PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString()) + MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty, + MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty, + SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty, + SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()), + PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty, + PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString()) }); // Configure the HTTP request pipeline.