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