From 901bc140f5aa300fbfa852e64afd7c65fceebff9 Mon Sep 17 00:00:00 2001 From: Eric Dahlvang Date: Thu, 1 Apr 2021 10:50:44 -0700 Subject: [PATCH] Update dotnet samples to use CoreBotAdapter (#3145) --- .../02.echo-bot/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/02.echo-bot/Startup.cs | 2 +- .../03.welcome-user/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/03.welcome-user/Startup.cs | 2 +- .../05.multi-turn-prompt/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/05.multi-turn-prompt/Startup.cs | 2 +- .../06.using-cards/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/06.using-cards/Startup.cs | 2 +- .../07.using-adaptive-cards/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/07.using-adaptive-cards/Startup.cs | 2 +- .../08.suggested-actions/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/08.suggested-actions/Startup.cs | 2 +- .../11.qnamaker/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/11.qnamaker/Startup.cs | 2 +- .../13.core-bot/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/13.core-bot/Startup.cs | 2 +- .../14.nlp-with-dispatch/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/14.nlp-with-dispatch/Startup.cs | 2 +- .../15.handling-attachments/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/15.handling-attachments/Startup.cs | 2 +- .../16.proactive-messages/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/16.proactive-messages/Startup.cs | 2 +- .../17.multilingual-bot/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/17.multilingual-bot/Startup.cs | 2 +- .../18.bot-authentication/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/18.bot-authentication/Startup.cs | 2 +- .../19.custom-dialogs/AdapterWithErrorHandler.cs | 9 +++++---- samples/csharp_dotnetcore/19.custom-dialogs/Startup.cs | 2 +- .../21.corebot-app-insights/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/21.corebot-app-insights/Startup.cs | 2 +- .../23.facebook-events/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/23.facebook-events/Startup.cs | 2 +- .../AdapterWithErrorHandler.cs | 7 ++++--- .../24.bot-authentication-msgraph/Startup.cs | 2 +- .../25.message-reaction/AdapterWithErrorHandler.cs | 9 +++++---- samples/csharp_dotnetcore/25.message-reaction/Startup.cs | 2 +- .../42.scaleout/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/42.scaleout/Startup.cs | 2 +- .../43.complex-dialog/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/43.complex-dialog/Startup.cs | 2 +- .../44.prompt-users-for-input/AdapterWithErrorHandler.cs | 7 ++++--- .../44.prompt-users-for-input/Startup.cs | 2 +- .../45.state-management/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/45.state-management/Startup.cs | 2 +- .../46.teams-auth/AdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/46.teams-auth/Startup.cs | 2 +- .../47.inspection/AdapterWithInspection.cs | 7 ++++--- samples/csharp_dotnetcore/47.inspection/Startup.cs | 2 +- .../49.qnamaker-all-features/AdapterWithErrorHandler.cs | 7 ++++--- .../49.qnamaker-all-features/Startup.cs | 2 +- .../AdapterWithErrorHandler.cs | 7 ++++--- .../50.teams-messaging-extensions-search/Startup.cs | 2 +- .../AdapterWithErrorHandler.cs | 7 ++++--- .../51.teams-messaging-extensions-action/Startup.cs | 2 +- .../AdapterWithErrorHandler.cs | 8 ++++---- .../Startup.cs | 2 +- .../AdapterWithErrorHandler.cs | 7 ++++--- .../Startup.cs | 2 +- .../54.teams-task-module/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/54.teams-task-module/Startup.cs | 2 +- .../55.teams-link-unfurling/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/55.teams-link-unfurling/Startup.cs | 2 +- .../56.teams-file-upload/AdapterWithErrorHandler.cs | 7 ++++--- .../csharp_dotnetcore/56.teams-file-upload/Startup.cs | 2 +- .../57.teams-conversation-bot/AdapterWithErrorHandler.cs | 7 ++++--- .../57.teams-conversation-bot/Startup.cs | 2 +- .../AdapterWithErrorHandler.cs | 7 ++++--- .../58.teams-start-new-thread-in-channel/Startup.cs | 2 +- .../Adapters/BotFrameworkAdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/60.slack-adapter/Startup.cs | 2 +- .../Adapters/BotFrameworkAdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/61.facebook-adapter/Startup.cs | 2 +- .../Adapters/BotFrameworkAdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/62.webex-adapter/Startup.cs | 2 +- .../Adapters/BotFrameworkAdapterWithErrorHandler.cs | 7 ++++--- samples/csharp_dotnetcore/63.twilio-adapter/Startup.cs | 2 +- 76 files changed, 192 insertions(+), 155 deletions(-) diff --git a/samples/csharp_dotnetcore/02.echo-bot/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/02.echo-bot/AdapterWithErrorHandler.cs index 251b0092a0..7ececcf281 100644 --- a/samples/csharp_dotnetcore/02.echo-bot/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/02.echo-bot/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/02.echo-bot/Startup.cs b/samples/csharp_dotnetcore/02.echo-bot/Startup.cs index c2d0ed4ae7..fec9a19865 100644 --- a/samples/csharp_dotnetcore/02.echo-bot/Startup.cs +++ b/samples/csharp_dotnetcore/02.echo-bot/Startup.cs @@ -25,7 +25,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/03.welcome-user/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/03.welcome-user/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/03.welcome-user/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/03.welcome-user/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/03.welcome-user/Startup.cs b/samples/csharp_dotnetcore/03.welcome-user/Startup.cs index 50ee34d171..e5a58a4e4c 100644 --- a/samples/csharp_dotnetcore/03.welcome-user/Startup.cs +++ b/samples/csharp_dotnetcore/03.welcome-user/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/05.multi-turn-prompt/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/05.multi-turn-prompt/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/05.multi-turn-prompt/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/05.multi-turn-prompt/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/05.multi-turn-prompt/Startup.cs b/samples/csharp_dotnetcore/05.multi-turn-prompt/Startup.cs index c73ebf94d8..06e6a3a642 100644 --- a/samples/csharp_dotnetcore/05.multi-turn-prompt/Startup.cs +++ b/samples/csharp_dotnetcore/05.multi-turn-prompt/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/06.using-cards/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/06.using-cards/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/06.using-cards/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/06.using-cards/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/06.using-cards/Startup.cs b/samples/csharp_dotnetcore/06.using-cards/Startup.cs index 7bcbf3a80c..99c2d6ae12 100644 --- a/samples/csharp_dotnetcore/06.using-cards/Startup.cs +++ b/samples/csharp_dotnetcore/06.using-cards/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/07.using-adaptive-cards/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/07.using-adaptive-cards/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/07.using-adaptive-cards/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/07.using-adaptive-cards/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/07.using-adaptive-cards/Startup.cs b/samples/csharp_dotnetcore/07.using-adaptive-cards/Startup.cs index c2d1f36acc..dab8037341 100644 --- a/samples/csharp_dotnetcore/07.using-adaptive-cards/Startup.cs +++ b/samples/csharp_dotnetcore/07.using-adaptive-cards/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/08.suggested-actions/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/08.suggested-actions/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/08.suggested-actions/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/08.suggested-actions/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/08.suggested-actions/Startup.cs b/samples/csharp_dotnetcore/08.suggested-actions/Startup.cs index 439e4a1fe1..a05b598492 100644 --- a/samples/csharp_dotnetcore/08.suggested-actions/Startup.cs +++ b/samples/csharp_dotnetcore/08.suggested-actions/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/11.qnamaker/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/11.qnamaker/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/11.qnamaker/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/11.qnamaker/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/11.qnamaker/Startup.cs b/samples/csharp_dotnetcore/11.qnamaker/Startup.cs index 44f46838a3..15060a4c9d 100644 --- a/samples/csharp_dotnetcore/11.qnamaker/Startup.cs +++ b/samples/csharp_dotnetcore/11.qnamaker/Startup.cs @@ -17,7 +17,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Add the HttpClientFactory to be used for the QnAMaker calls. services.AddHttpClient(); diff --git a/samples/csharp_dotnetcore/13.core-bot/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/13.core-bot/AdapterWithErrorHandler.cs index 3744aab834..a47fa1443f 100644 --- a/samples/csharp_dotnetcore/13.core-bot/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/13.core-bot/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -11,10 +12,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/13.core-bot/Startup.cs b/samples/csharp_dotnetcore/13.core-bot/Startup.cs index e1eae8ccc2..af1efc7a94 100644 --- a/samples/csharp_dotnetcore/13.core-bot/Startup.cs +++ b/samples/csharp_dotnetcore/13.core-bot/Startup.cs @@ -17,7 +17,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/14.nlp-with-dispatch/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/14.nlp-with-dispatch/AdapterWithErrorHandler.cs index 90c986a9fd..7229989d4c 100644 --- a/samples/csharp_dotnetcore/14.nlp-with-dispatch/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/14.nlp-with-dispatch/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/14.nlp-with-dispatch/Startup.cs b/samples/csharp_dotnetcore/14.nlp-with-dispatch/Startup.cs index d771093090..ea3847d2b1 100644 --- a/samples/csharp_dotnetcore/14.nlp-with-dispatch/Startup.cs +++ b/samples/csharp_dotnetcore/14.nlp-with-dispatch/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/15.handling-attachments/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/15.handling-attachments/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/15.handling-attachments/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/15.handling-attachments/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/15.handling-attachments/Startup.cs b/samples/csharp_dotnetcore/15.handling-attachments/Startup.cs index 20735a69c9..c061738b51 100644 --- a/samples/csharp_dotnetcore/15.handling-attachments/Startup.cs +++ b/samples/csharp_dotnetcore/15.handling-attachments/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/16.proactive-messages/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/16.proactive-messages/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/16.proactive-messages/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/16.proactive-messages/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/16.proactive-messages/Startup.cs b/samples/csharp_dotnetcore/16.proactive-messages/Startup.cs index 133486a70c..4523a247d0 100644 --- a/samples/csharp_dotnetcore/16.proactive-messages/Startup.cs +++ b/samples/csharp_dotnetcore/16.proactive-messages/Startup.cs @@ -17,7 +17,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/17.multilingual-bot/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/17.multilingual-bot/AdapterWithErrorHandler.cs index a3909312d2..c571675a57 100644 --- a/samples/csharp_dotnetcore/17.multilingual-bot/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/17.multilingual-bot/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; using Microsoft.Bot.Builder; @@ -13,10 +14,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, TranslationMiddleware translationMiddleware, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, TranslationMiddleware translationMiddleware, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { if (translationMiddleware == null) { diff --git a/samples/csharp_dotnetcore/17.multilingual-bot/Startup.cs b/samples/csharp_dotnetcore/17.multilingual-bot/Startup.cs index 113a2588c2..96108dd231 100644 --- a/samples/csharp_dotnetcore/17.multilingual-bot/Startup.cs +++ b/samples/csharp_dotnetcore/17.multilingual-bot/Startup.cs @@ -23,7 +23,7 @@ public Startup() // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/18.bot-authentication/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/18.bot-authentication/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/18.bot-authentication/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/18.bot-authentication/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/18.bot-authentication/Startup.cs b/samples/csharp_dotnetcore/18.bot-authentication/Startup.cs index afe77ef7d6..c843be64db 100644 --- a/samples/csharp_dotnetcore/18.bot-authentication/Startup.cs +++ b/samples/csharp_dotnetcore/18.bot-authentication/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/19.custom-dialogs/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/19.custom-dialogs/AdapterWithErrorHandler.cs index adaf704450..fb0743826e 100644 --- a/samples/csharp_dotnetcore/19.custom-dialogs/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/19.custom-dialogs/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,11 +11,11 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) - { + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) + { OnTurnError = async (turnContext, exception) => { // Log any leaked exception from the application. diff --git a/samples/csharp_dotnetcore/19.custom-dialogs/Startup.cs b/samples/csharp_dotnetcore/19.custom-dialogs/Startup.cs index 5ff51ac2b7..b9897f56c3 100644 --- a/samples/csharp_dotnetcore/19.custom-dialogs/Startup.cs +++ b/samples/csharp_dotnetcore/19.custom-dialogs/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/21.corebot-app-insights/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/21.corebot-app-insights/AdapterWithErrorHandler.cs index 0e0dbd70de..15c3bd51f4 100644 --- a/samples/csharp_dotnetcore/21.corebot-app-insights/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/21.corebot-app-insights/AdapterWithErrorHandler.cs @@ -10,16 +10,17 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using System.Collections.Generic; +using System.Net.Http; namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { //Create field for telemetry client. Add IBotTelemetryClient parameter to AdapterWithErrorHandler private IBotTelemetryClient _adapterBotTelemetryClient; - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, TelemetryInitializerMiddleware telemetryInitializerMiddleware, IBotTelemetryClient botTelemetryClient, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, TelemetryInitializerMiddleware telemetryInitializerMiddleware, IBotTelemetryClient botTelemetryClient, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { Use(telemetryInitializerMiddleware); diff --git a/samples/csharp_dotnetcore/21.corebot-app-insights/Startup.cs b/samples/csharp_dotnetcore/21.corebot-app-insights/Startup.cs index 0bade090d1..fd676ddb36 100644 --- a/samples/csharp_dotnetcore/21.corebot-app-insights/Startup.cs +++ b/samples/csharp_dotnetcore/21.corebot-app-insights/Startup.cs @@ -20,7 +20,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/23.facebook-events/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/23.facebook-events/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/23.facebook-events/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/23.facebook-events/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/23.facebook-events/Startup.cs b/samples/csharp_dotnetcore/23.facebook-events/Startup.cs index e610ce01ca..1d9f7fe2fe 100644 --- a/samples/csharp_dotnetcore/23.facebook-events/Startup.cs +++ b/samples/csharp_dotnetcore/23.facebook-events/Startup.cs @@ -21,7 +21,7 @@ public Startup() // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/24.bot-authentication-msgraph/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/24.bot-authentication-msgraph/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/24.bot-authentication-msgraph/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/24.bot-authentication-msgraph/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/24.bot-authentication-msgraph/Startup.cs b/samples/csharp_dotnetcore/24.bot-authentication-msgraph/Startup.cs index afe77ef7d6..c843be64db 100644 --- a/samples/csharp_dotnetcore/24.bot-authentication-msgraph/Startup.cs +++ b/samples/csharp_dotnetcore/24.bot-authentication-msgraph/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/25.message-reaction/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/25.message-reaction/AdapterWithErrorHandler.cs index dc5d32d650..4ca14b5b22 100644 --- a/samples/csharp_dotnetcore/25.message-reaction/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/25.message-reaction/AdapterWithErrorHandler.cs @@ -1,17 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) - { + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) + { OnTurnError = async (turnContext, exception) => { // Log any leaked exception from the application. diff --git a/samples/csharp_dotnetcore/25.message-reaction/Startup.cs b/samples/csharp_dotnetcore/25.message-reaction/Startup.cs index 159f07e802..b5a59e7b2d 100644 --- a/samples/csharp_dotnetcore/25.message-reaction/Startup.cs +++ b/samples/csharp_dotnetcore/25.message-reaction/Startup.cs @@ -24,7 +24,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the storage we'll be using for User and Conversation state. (Memory is great for testing purposes.) services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/42.scaleout/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/42.scaleout/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/42.scaleout/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/42.scaleout/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/42.scaleout/Startup.cs b/samples/csharp_dotnetcore/42.scaleout/Startup.cs index ba7cdd04e4..e11aaca8b0 100644 --- a/samples/csharp_dotnetcore/42.scaleout/Startup.cs +++ b/samples/csharp_dotnetcore/42.scaleout/Startup.cs @@ -17,7 +17,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the credential provider to be used with the Bot Framework Adapter. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/43.complex-dialog/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/43.complex-dialog/AdapterWithErrorHandler.cs index adaf704450..c5402753ef 100644 --- a/samples/csharp_dotnetcore/43.complex-dialog/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/43.complex-dialog/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/43.complex-dialog/Startup.cs b/samples/csharp_dotnetcore/43.complex-dialog/Startup.cs index 6c41ae165a..b9fe319a84 100644 --- a/samples/csharp_dotnetcore/43.complex-dialog/Startup.cs +++ b/samples/csharp_dotnetcore/43.complex-dialog/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/44.prompt-users-for-input/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/44.prompt-users-for-input/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/44.prompt-users-for-input/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/44.prompt-users-for-input/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/44.prompt-users-for-input/Startup.cs b/samples/csharp_dotnetcore/44.prompt-users-for-input/Startup.cs index 3ea3aa036a..001dbae654 100644 --- a/samples/csharp_dotnetcore/44.prompt-users-for-input/Startup.cs +++ b/samples/csharp_dotnetcore/44.prompt-users-for-input/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/45.state-management/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/45.state-management/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/45.state-management/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/45.state-management/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/45.state-management/Startup.cs b/samples/csharp_dotnetcore/45.state-management/Startup.cs index 4682ea2000..24ee67a98c 100644 --- a/samples/csharp_dotnetcore/45.state-management/Startup.cs +++ b/samples/csharp_dotnetcore/45.state-management/Startup.cs @@ -16,7 +16,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/46.teams-auth/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/46.teams-auth/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/46.teams-auth/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/46.teams-auth/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/46.teams-auth/Startup.cs b/samples/csharp_dotnetcore/46.teams-auth/Startup.cs index d01f4e8c82..72da5b8bfb 100644 --- a/samples/csharp_dotnetcore/46.teams-auth/Startup.cs +++ b/samples/csharp_dotnetcore/46.teams-auth/Startup.cs @@ -15,7 +15,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/47.inspection/AdapterWithInspection.cs b/samples/csharp_dotnetcore/47.inspection/AdapterWithInspection.cs index d4d5423a25..b5459363d2 100644 --- a/samples/csharp_dotnetcore/47.inspection/AdapterWithInspection.cs +++ b/samples/csharp_dotnetcore/47.inspection/AdapterWithInspection.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithInspection : BotFrameworkHttpAdapter + public class AdapterWithInspection : CloudAdapter { - public AdapterWithInspection(IConfiguration configuration, InspectionState inspectionState, UserState userState, ConversationState conversationState, ILogger logger) - : base(configuration, logger) + public AdapterWithInspection(IConfiguration configuration, IHttpClientFactory httpClientFactory, InspectionState inspectionState, UserState userState, ConversationState conversationState, ILogger logger) + : base(configuration, httpClientFactory, logger) { // Inspection needs credentiaols because it will be sending the Activities and User and Conversation State to the emulator var credentials = new MicrosoftAppCredentials(configuration["MicrosoftAppId"], configuration["MicrosoftAppPassword"]); diff --git a/samples/csharp_dotnetcore/47.inspection/Startup.cs b/samples/csharp_dotnetcore/47.inspection/Startup.cs index 6be64b27fc..43be61ab2a 100644 --- a/samples/csharp_dotnetcore/47.inspection/Startup.cs +++ b/samples/csharp_dotnetcore/47.inspection/Startup.cs @@ -16,7 +16,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/49.qnamaker-all-features/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/49.qnamaker-all-features/AdapterWithErrorHandler.cs index adaf704450..b8c77f87c2 100644 --- a/samples/csharp_dotnetcore/49.qnamaker-all-features/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/49.qnamaker-all-features/AdapterWithErrorHandler.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Net.Http; using Microsoft.Bot.Builder; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; @@ -10,10 +11,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger, ConversationState conversationState = null) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/49.qnamaker-all-features/Startup.cs b/samples/csharp_dotnetcore/49.qnamaker-all-features/Startup.cs index cb5514fe51..06589e6bbe 100644 --- a/samples/csharp_dotnetcore/49.qnamaker-all-features/Startup.cs +++ b/samples/csharp_dotnetcore/49.qnamaker-all-features/Startup.cs @@ -25,7 +25,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/AdapterWithErrorHandler.cs index 251b0092a0..7ececcf281 100644 --- a/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/Startup.cs b/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/Startup.cs index c5d2ade42f..68be33f608 100644 --- a/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/Startup.cs +++ b/samples/csharp_dotnetcore/50.teams-messaging-extensions-search/Startup.cs @@ -25,7 +25,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/AdapterWithErrorHandler.cs index bd83e07e3e..ab07a8bf1f 100644 --- a/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/Startup.cs b/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/Startup.cs index e23fe47a10..0bde2816fa 100644 --- a/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/Startup.cs +++ b/samples/csharp_dotnetcore/51.teams-messaging-extensions-action/Startup.cs @@ -25,7 +25,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/AdapterWithErrorHandler.cs index 59d50617a8..972a3c4b76 100644 --- a/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/AdapterWithErrorHandler.cs @@ -9,14 +9,14 @@ using Microsoft.Bot.Schema; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; - +using System.Net.Http; namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger, ConversationState conversationState = null) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/Startup.cs b/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/Startup.cs index abfa3fcc24..33713dec8a 100644 --- a/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/Startup.cs +++ b/samples/csharp_dotnetcore/52.teams-messaging-extensions-search-auth-config/Startup.cs @@ -25,7 +25,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create storage and UserState for User configuration settings. services.AddSingleton(new MemoryStorage()); diff --git a/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/AdapterWithErrorHandler.cs index 251b0092a0..7ececcf281 100644 --- a/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/Startup.cs b/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/Startup.cs index aa740318f2..a1e75a2db6 100644 --- a/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/Startup.cs +++ b/samples/csharp_dotnetcore/53.teams-messaging-extensions-action-preview/Startup.cs @@ -24,7 +24,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the storage we'll be using for User and Conversation state. (Memory is great for testing purposes.) services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/54.teams-task-module/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/54.teams-task-module/AdapterWithErrorHandler.cs index dc5d32d650..6c54e7dfd0 100644 --- a/samples/csharp_dotnetcore/54.teams-task-module/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/54.teams-task-module/AdapterWithErrorHandler.cs @@ -1,16 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/54.teams-task-module/Startup.cs b/samples/csharp_dotnetcore/54.teams-task-module/Startup.cs index b4d4263b37..80c0838bbe 100644 --- a/samples/csharp_dotnetcore/54.teams-task-module/Startup.cs +++ b/samples/csharp_dotnetcore/54.teams-task-module/Startup.cs @@ -26,7 +26,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); services.AddRazorPages(); // Create the Bot Framework Adapter with error handling enabled. diff --git a/samples/csharp_dotnetcore/55.teams-link-unfurling/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/55.teams-link-unfurling/AdapterWithErrorHandler.cs index bd83e07e3e..ab07a8bf1f 100644 --- a/samples/csharp_dotnetcore/55.teams-link-unfurling/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/55.teams-link-unfurling/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/55.teams-link-unfurling/Startup.cs b/samples/csharp_dotnetcore/55.teams-link-unfurling/Startup.cs index 212453c951..8c7a517fe5 100644 --- a/samples/csharp_dotnetcore/55.teams-link-unfurling/Startup.cs +++ b/samples/csharp_dotnetcore/55.teams-link-unfurling/Startup.cs @@ -24,7 +24,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the storage we'll be using for User and Conversation state. (Memory is great for testing purposes.) services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/56.teams-file-upload/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/56.teams-file-upload/AdapterWithErrorHandler.cs index 251b0092a0..7ececcf281 100644 --- a/samples/csharp_dotnetcore/56.teams-file-upload/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/56.teams-file-upload/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/56.teams-file-upload/Startup.cs b/samples/csharp_dotnetcore/56.teams-file-upload/Startup.cs index a62ae034dd..3e25a0f5e1 100644 --- a/samples/csharp_dotnetcore/56.teams-file-upload/Startup.cs +++ b/samples/csharp_dotnetcore/56.teams-file-upload/Startup.cs @@ -25,7 +25,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/57.teams-conversation-bot/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/57.teams-conversation-bot/AdapterWithErrorHandler.cs index 90a29c7b1d..fa16553cfa 100644 --- a/samples/csharp_dotnetcore/57.teams-conversation-bot/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/57.teams-conversation-bot/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/57.teams-conversation-bot/Startup.cs b/samples/csharp_dotnetcore/57.teams-conversation-bot/Startup.cs index 389674ac2d..cf1fa7b2ec 100644 --- a/samples/csharp_dotnetcore/57.teams-conversation-bot/Startup.cs +++ b/samples/csharp_dotnetcore/57.teams-conversation-bot/Startup.cs @@ -24,7 +24,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/AdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/AdapterWithErrorHandler.cs index 90a29c7b1d..fa16553cfa 100644 --- a/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/AdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/AdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples { - public class AdapterWithErrorHandler : BotFrameworkHttpAdapter + public class AdapterWithErrorHandler : CloudAdapter { - public AdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public AdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/Startup.cs b/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/Startup.cs index c1d5002b87..50561dc3b3 100644 --- a/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/Startup.cs +++ b/samples/csharp_dotnetcore/58.teams-start-new-thread-in-channel/Startup.cs @@ -24,7 +24,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the Bot Framework Adapter with error handling enabled. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/60.slack-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/60.slack-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs index 52c6d6ec27..e5f8dd9939 100644 --- a/samples/csharp_dotnetcore/60.slack-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/60.slack-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples.Adapters { - public class BotFrameworkAdapterWithErrorHandler : BotFrameworkHttpAdapter + public class BotFrameworkAdapterWithErrorHandler : CloudAdapter { - public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/60.slack-adapter/Startup.cs b/samples/csharp_dotnetcore/60.slack-adapter/Startup.cs index 4506483586..699152780e 100644 --- a/samples/csharp_dotnetcore/60.slack-adapter/Startup.cs +++ b/samples/csharp_dotnetcore/60.slack-adapter/Startup.cs @@ -18,7 +18,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the default Bot Framework Adapter (used for Azure Bot Service channels and emulator). services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/61.facebook-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/61.facebook-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs index 52c6d6ec27..e5f8dd9939 100644 --- a/samples/csharp_dotnetcore/61.facebook-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/61.facebook-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples.Adapters { - public class BotFrameworkAdapterWithErrorHandler : BotFrameworkHttpAdapter + public class BotFrameworkAdapterWithErrorHandler : CloudAdapter { - public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/61.facebook-adapter/Startup.cs b/samples/csharp_dotnetcore/61.facebook-adapter/Startup.cs index 92ed9c7256..e537af5b3c 100644 --- a/samples/csharp_dotnetcore/61.facebook-adapter/Startup.cs +++ b/samples/csharp_dotnetcore/61.facebook-adapter/Startup.cs @@ -18,7 +18,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the default Bot Framework Adapter (used for Azure Bot Service channels and emulator). services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/62.webex-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/62.webex-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs index 52c6d6ec27..e5f8dd9939 100644 --- a/samples/csharp_dotnetcore/62.webex-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/62.webex-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples.Adapters { - public class BotFrameworkAdapterWithErrorHandler : BotFrameworkHttpAdapter + public class BotFrameworkAdapterWithErrorHandler : CloudAdapter { - public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/62.webex-adapter/Startup.cs b/samples/csharp_dotnetcore/62.webex-adapter/Startup.cs index 2589d1a854..4931deeacb 100644 --- a/samples/csharp_dotnetcore/62.webex-adapter/Startup.cs +++ b/samples/csharp_dotnetcore/62.webex-adapter/Startup.cs @@ -18,7 +18,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the default Bot Framework Adapter. services.AddSingleton(); diff --git a/samples/csharp_dotnetcore/63.twilio-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs b/samples/csharp_dotnetcore/63.twilio-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs index 774c4fbca1..e5f8dd9939 100644 --- a/samples/csharp_dotnetcore/63.twilio-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs +++ b/samples/csharp_dotnetcore/63.twilio-adapter/Adapters/BotFrameworkAdapterWithErrorHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Net.Http; using Microsoft.Bot.Builder.Integration.AspNet.Core; using Microsoft.Bot.Builder.TraceExtensions; using Microsoft.Extensions.Configuration; @@ -8,10 +9,10 @@ namespace Microsoft.BotBuilderSamples.Adapters { - public class BotFrameworkAdapterWithErrorHandler : BotFrameworkHttpAdapter + public class BotFrameworkAdapterWithErrorHandler : CloudAdapter { - public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, ILogger logger) - : base(configuration, logger) + public BotFrameworkAdapterWithErrorHandler(IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) + : base(configuration, httpClientFactory, logger) { OnTurnError = async (turnContext, exception) => { diff --git a/samples/csharp_dotnetcore/63.twilio-adapter/Startup.cs b/samples/csharp_dotnetcore/63.twilio-adapter/Startup.cs index 583bfa6759..9c8b287514 100644 --- a/samples/csharp_dotnetcore/63.twilio-adapter/Startup.cs +++ b/samples/csharp_dotnetcore/63.twilio-adapter/Startup.cs @@ -18,7 +18,7 @@ public class Startup // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddControllers().AddNewtonsoftJson(); + services.AddHttpClient().AddControllers().AddNewtonsoftJson(); // Create the default Bot Framework Adapter (used for Azure Bot Service channels and emulator). services.AddSingleton();