Convert SentimentAnalysisMiddleware to the package
Hi @garypretty - assigning it myself for this one.
The idea is to convert these middleware(s), starting with Sentiment Analysis Middleware to the package one by one and then we can work on the samples / docs for these.
Hey Arafat.
A good place for you to look is the LivePerson component. Here you can see that you register the middleware in your component by registering as a singleton and then it will be automatically picked up and added to the pipeline. https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/blob/8ee1370c551304f7f16e008cea1daab001973a44/libraries/Bot.Builder.Community.Components.Handoff.LivePerson/LivePersonHandoffComponent.cs#L13
I would recommend though that you add some form of setting to enable / disable the middleware, using the IConfiguration that gets passed in. You can then advise the user to add the appropriate setting(s), as I do here for LP https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/feature/packages-preview/libraries/Bot.Builder.Community.Components.Handoff.LivePerson.
e.g. you might have the following setting.
"Bot.Builder.Community.Components.Middleware.SentimentAnalysis": { "Enabled": true }
and then use the value to wrap everything in the OnTurn event in your middleware.
Does that help / make sense?
I am merging the components to the develop branch in the next couple of hours, so you might want to wait until then to create your branch.
Thanks @garypretty for the detailed explanation. Yes, it does make sense and I will aim for this one! 👍