Explain Areas in MVC?( MVC interview questions with answers)
- By Shiv Prasad Koirala in ASP.NET
- Jan 17th, 2014
- 9592
- 0
This question is taken from book .NET interview question published by BPB publications http://www.flipkart.com/net-interview-questions-6th/p/itmdyuqzdqx8cvqx .
In case you are new to MVC you can start with www.questpond.com MVC videos from here http://www.youtube.com/watch?v=KAKxm4eQP24
Areas help you to group functionalities in to independent modules thus making your project more organized. For example in the below MVC project we have four controller classes and as time passes by if more controller classes are added it will be difficult to manage. In bigger projects you will end up with 100's of controller classes making life hell for maintenance.
If we can group controller classes in to logical section like "Invoicing" and "Accounting" that would make life easier and that's what "Area" are meant to.
You can add an area by right clicking on the MVC solution and clicking on "Area" menu as shown in the below figure.
In the below image we have two "Areas" created "Account" and "Invoicing" and in that I have put the respective controllers. You can see how the project is looking more organized as compared to the previous state.
Recently one of our readers who had gone for TCS India for interview for MVC position was asked to explain difference between viewdata,viewbag,tempdata and session.
Below is a video created by www.questpond.com which explains the same in more detail.
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more