lundi 13 février 2017

how to get all controller name in multi project in one sulotion

I have a solution that added multi mvc project. now how to get all controller name from all mvc project.

var _controllerTypes = AppDomain.CurrentDomain.GetAssemblies()
                .SelectMany(a => a.GetTypes())
                .Where(t => t != null
                    && t.IsPublic
                    && t.Name.EndsWith("Controller", StringComparison.OrdinalIgnoreCase)
                    && !t.IsAbstract
                    && typeof(IController).IsAssignableFrom(t));

the above code work on current project but i want get all assembly.





Aucun commentaire:

Enregistrer un commentaire