From the course: Using Entity Framework Core with Legacy Databases

Unlock the full course today

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

Why change the generated model

Why change the generated model

From the course: Using Entity Framework Core with Legacy Databases

Start my 1-month free trial

Why change the generated model

- [Instructor] Now we have a functioning Entity Framework Model against our database, we know how to keep it updated, and we know how to use it to update the database. Isn't that all we need? It is, but we can do better. We wanna have code that is easy to read and maintain in the long term. To maximize the value of Entity Framework, there are changes that we can make to improve the way that the application interacts with the data. We could improve the names of tables and properties to semantically name the fields. We can hide things that don't matter to the application with shadow properties and backing fields. We can isolate specific database logic with things like concurrency tokens and generated columns. Often, additions to the model can be made to improve the code. But we don't want those additions in the database, just in the code. As an example, let's open up the Models folder and navigate to the Salesperson model. In the main program, we used the first name and last name…

Contents