Introduction : This is a simple application using ASP.NET MVC tools. This is for beginners how to create a database in a MVC application. The ASP.NET MVC framework supports using any data access technology, and developers can choose from a variety of rich .NET data options to implement their models including: LINQ to Entities, LINQ to SQL, NHibernate, LLBLGen Pro, SubSonic, WilsonORM, or just raw ADO.NET DataReaders or Datasets. If you developed any information based project first need is manage information in database. ASP.NET MVC provide some tools that used add the data base in your application easily. This is a very simple program I hope it's very helpful for beginners and solve the problem how to create database in a MVC application.

Step 1 :

start.gif

Step 2 : Next step add one folder in Solution Explorer.

appfolder.gif

Step 3: In a App_Data folder add LINQ to SQL CLASS. LINQ to SQL will then takes care of generating the appropriate SQL execution logic to use at runtime when we interact and use them.

linq-class.gif

Step 4 : After add the LINQ to SQL class two file create in folder.

Step 5 : Open the Server Explorer.

open-solution-exfloree.gif

mdf-file.gif

tableshema.gif

Step 6: If you want to set the Primary key and Relationship.

saverecor.gif
set-primary-key.gif

relationship.gif

Step 7 : Click the table.

enter-table-records.gif