Jump to content

Code first or Db first which approach is acceptable in MVC ?


Tamzid10028

Recommended Posts

Overview

In this walkthrough you will build pieces of a blogging application. The walkthrough will not result in a fully functional blogging application, but instead it will use the blog classes to demonstrate code first’s features. You will:

  • Define a set of classes to represent the entities for a blog — Blog, Post and Comment.
  • Reference the Entity Framework code first assembly.
  • Create a DbContext to manage the Blog classes and data access.
  • Build a simple ASP.NET MVC 3 application that will let you view, add, edit and delete blogs.
Creating the MVC Application

For this demo, all of the code will live inside of an MVC 3 project so the first step will be to create that project. You’ll use a template that will set up much of the structure for the application.

If you have not installed MVC 3 you can find the download and instructions at http://www.asp.net/mvc/mvc3.

  1. In Visual Studio 2010, add a new project by selecting the File menu, then New and then Project.
  2. In the Search Installed Templates text box (top right), type MVC 3 to filter down the list of project templates.
  3. Select ASP.NET MVC 3 Web Application using your language of choice. This walkthrough will use C# code, but you can find both C# and Visual Basic versions in the sample solutions download.
  4. Name the project MVC3AppCodeFirst and then click OK.
  5. In the New ASP.NET MVC 3 Project wizard, choose Internet Application.
  6. Leave the default values of the other options and click OK.
Link to comment
Share on other sites

In answer to the OP, it doesn't matter really. In our team, for example, developers routinely stub in data to test their code with while db development is ongoing by our db team. The code and db are integrated prior to going to UAT.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.