From the course: Building Angular and ASP.NET Web API Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Configuring a database

Configuring a database

From the course: Building Angular and ASP.NET Web API Apps

Start my 1-month free trial

Configuring a database

- [Instructor] On the last part, we created the AppDbContext file, which will be used to work the database. And on this part, we're going to learn how the Entity Framework decides the database name and server while initializing a database in the Code First approach. With Entity Framework, we can define the database using the DbContext constructor, which has three possible options. No parameter, database name, and the connection string name. Now if you choose the first and the second option, it means that the Entity Framework will create the database in our SQL Express server, but this is not the case, so we are going to use the third option, which is the most used option, because you are not restricted to use your own SQL Express server. But, to configure the database, we will go through some steps. We'll first declare the constructor, then we will get the database connection string, and then later we will add migrations, enter some default data and send this data to our database, and…

Contents