Posted by Anuraj on Monday, November 10, 2014 Reading time :1 minute
As part of ASP.NET MVC 6, Microsoft introduced POCO(Plain Old CLR Object) Controllers. Unlike MVC 5 or previous versions of MVC, POCO contollers, has no base class, no need to implement any interface, it is 100% convention.
POCO controller implementation.
As long as your class is public, non-abstract, has a Controller suffix and is defined in an assembly that references any of the MVC assemblies (Microsoft.AspNet.Mvc.Core, Microsoft.AspNet.Mvc etc), it will be discovered as a valid controller.
The Activate attribute will help ASP.Net runtime to inject various services to the controller. You can use ViewDataDictionary.Model property for passing Model to view in POCO controllers.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.