Join Richard Goforth for an in-depth discussion in this video Changing names, part of Accessing Existing Databases with Entity Framework Core.
- [Instructor] Often a database,…especially one that's been around for a while…has a lot of terrible names.…Or a terrible naming convention…that really muddies up the meanings behind the fields.…If we rename those fields,…we can add a lot of clarity to our code.…In our customer model, we can see that each field…starts with StrFld…for stringfield.…Since in the code…we already know that these are strings and fields,…we don't need this extra information…and writing logic with these properties would be confusing.…Let's remove this extra information from our model.…
In Visual Studio,…I can hold down Alt and Shift to select down a column.…I'm going to select each of the Str fields and delete.…All right, my names look a lot better now…but I need to fix the context, as well.…Let's move to the context.…In the context, we can see that the fields are missing…and so we'll individually correct…each of these fields in the model.…Again, we haven't changed the database.…Each column name still remains the same.…Each property uses HasColumnName…
- 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
SQL Server 2014 Essential Trainingwith Martin Guidry3h 51m Intermediate
Microsoft SQL Server 2014: Backup and Recoverywith Martin Guidry1h 22m Intermediate
1. Get Started with EF Core: On Your Legacy Database
2. Improve the Model
3. Model Complex Relationships
4. Work with Non-Microsoft Databases
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take 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.