microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Plugins/Microsoft.Teams.Plugins.AspNetCore.BotBuilder/RemoveDefaultMessageController.cs
16lines · modecode
| 1 | using Microsoft.AspNetCore.Mvc.ApplicationParts; |
| 2 | using Microsoft.AspNetCore.Mvc.Controllers; |
| 3 | using System.Reflection; |
| 4 | |
| 5 | public class RemoveDefaultMessageController : IApplicationFeatureProvider<ControllerFeature> |
| 6 | { |
| 7 | public void PopulateFeature(IEnumerable<ApplicationPart> parts, ControllerFeature feature) |
| 8 | { |
| 9 | Type messageController = typeof(Microsoft.Teams.Plugins.AspNetCore.Controllers.MessageController); |
| 10 | |
| 11 | List<TypeInfo> matches = feature.Controllers.Where(c => c.AsType() == messageController).ToList(); |
| 12 | foreach (TypeInfo match in matches) { |
| 13 | feature.Controllers.Remove(match); |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | |