Join Richard Goforth for an in-depth discussion in this video Why change the generated model, part of Accessing Existing Databases with Entity Framework Core.
- [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 want to 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 manage 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 together.…Let's add a FullName property to the model…
Author
Released
11/18/2016- Setting up your project
- Connecting to a legacy database
- Scaffolding an initial model and context
- Improving the model
- Updating properties and indexes
- Adding concurrency tokens and timestamps
- Creating complex relationships
- Working with non-Microsoft databases such as SQLite and PostgreSQL
Skill Level Intermediate
Duration
Views
Related Courses
-
Learning Entity Framework 6.1.3
with Phil Japikse1h 34m Intermediate -
SQL Server 2014 Essential Training
with Martin Guidry3h 51m Intermediate -
Microsoft SQL Server 2014: Backup and Recovery
with Martin Guidry1h 22m Intermediate -
C#: Design Patterns
with Reynald Adolphe1h 22m Intermediate
-
Introduction
-
Welcome to EF Core1m 7s
-
What you need to know1m 25s
-
Using the exercise files2m 16s
-
-
1. Get Started with EF Core: On Your Legacy Database
-
Setting up your project2m 14s
-
Choose your approach2m 34s
-
-
2. Improve the Model
-
Changing names1m 49s
-
Using Shadow Properties2m 23s
-
Using backing fields3m 35s
-
Adding and altering indexes3m 38s
-
3. Model Complex Relationships
-
Navigation properties3m 34s
-
Accessing computed columns2m 43s
-
4. Work with Non-Microsoft Databases
-
Create a SQLite database4m 29s
-
Populate a SQLite database2m 24s
-
PostgreSQL2m 25s
-
Other Options1m 46s
-
Conclusion
-
Next steps39s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Why change the generated model