From the course: Advanced ASP.NET Web API 2.2

Unlock the full course today

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

Setting up a database

Setting up a database

From the course: Advanced ASP.NET Web API 2.2

Start my 1-month free trial

Setting up a database

- [Instructor] Now that we have set up the OData controller and the appdb context file, we can learn how to manipulate data. But before we do that, we need to set up the database using the Entity Framework. To set up the database using the Entity Framework, we are going to first enable migrations, then next, we are going to add a migration and at the end, we are going to apply a migration. So let us go to Visual Studio and see that in action. In here before we started as set the OData project as the startup project and then next, go to the Package Manager Console. Here, let us write Enable-Migrations. And we are getting an error which says that the EntityFramework package is not installed in the WebApi.DI. And that's right because we not working on the DI project, we are working on the OData project. So let us change the default project in here to the WebApi.OData and execute this command one more time. Now, before we…

Contents