connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebUx-20121229234926;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebUx-20121229234926.mdf" providerName="System.Data.SqlClient" />
Here is what the above code is Doing:
1. It’s telling the application to use the default connection string (which is the one we just created)
2. It’s telling the application to use the SqlClient provider (which is the one we just created)
Now, we need to create the database. To do this, we need to run the following command in the Package Manager Console:
This will create the database and the tables. If you want to see the tables, you can open up SQL Server Management Studio and connect to the database. The database will be in the App_Data folder.
Now, we need to create the database context. This is the class that will be used to interact with the database. To do this, we need to create a new class in the Models folder called ApplicationDbContext. This class needs to inherit from DbContext. Here’s what the code looks like: