Home how to get all the controller types from different assembly
Reply: 0

how to get all the controller types from different assembly

user641
1#
user641 Published in May 25, 2018, 6:53 pm

I am implementing Custom Remote Validation, where I need to get all controllers and for that I have used the code:

Type controller = Assembly.GetExecutingAssembly().GetTypes()
                .FirstOrDefault(type => type.Name.ToLower() == string.Format("{0}Controller",this.RouteData["controller"].ToString()).ToLower());

But, the problem is my controllers and viewModels are on two different assemblies so Assembly.GetExecutingAssembly() doesn't get any controller. The above code is in the assembly where i have a view model. How can i get all the controllers from different assembly.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306244 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO