I am doing the tutorial about movies of Microsoft to learn ASP.NET MVC4. I want some more information if that is possible.
I am at the page http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-model .
It says to add this class at the movie class
public class MovieDBContext : DbContext
{
public DbSet<Movie> Movies { get; set; }
}
And then to create a new connection string
<add name="MovieDBContext"
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Movies.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"
/>
And this is to get the info for the movies.
My question however, is the following. If we have two tables at the database, one for the movies and one for the actors for example. And we wanted to get the data of both of these tables, we should create two different models right? But we would use only one database(connection string). Then, how we will be able to say that the actor model, will take data from the actor table, and the movie model to take data from the movie table, but the two to have the same connection string?
EDIT:
Suppose I already have the two database tables before I create my project. Then how I make my models to point to them?