In tutorials and walkthroughs on developing an MVC3 (MVC2) using EF (EntityFramework, Entity Framework 4.1/4.2) I observe quite different orders of adding Model, View, Controller to a project in a Microsoft Visual Studio 2010.
What are cons and pros of different orders of adding M, V and Cs?
and of, for example, adding a model before and, more specifically, after a view and controller?
There is no specific rules for adding one over the other first. When you create an empty ASP.NET MVC3 Project, It will come with some default folder structure which includes one Controller folder, Views folder and Models folder.
Now If you are beginner, This is what i suggest. Add a
controllerfirst.Simply right click ont he
Controllerfolder and SelectAdd->Controllerfrom the context menu and add your first controller(Give the name asHomeController). It will come with a DefaultIndexaction method and you can see a return View statement. Run your project now. It will show you an error saying that it can not find a view. So now it is the time to add a view. Go the index action in home controller. Right click on theReturn View()statement and select Add View that will add a view (index.xshtml) under the home folder under Views. Now run the app and you will see the page content.If you are going to interact with your database, you can add model classes. If you can add POCO class file to your
Modelsfolder or you can have it on a different library which is refered to this projcet. It’s all up to you.As Lavinski mentioned, If you create your models first, You can use Scaffolding to create the controller actions for you. But If you are beginner, I would suggest you to create your controllers and views by hand. That will help you to understand MVC
configurationworks