Join Richard Goforth for an in-depth discussion in this video Generated properties and default values, part of Accessing Existing Databases with Entity Framework Core.
- [Narrator] Value generation is an integral part…of many databases.…For non-nullable fields,…a default value can prevent the need…to require a value when a new row is added.…Let's illustrate value generation with Entity Framework…by adding a new order to the database.…We'll go straight to our main method in the program.…We can remove our salesperson list from earlier.…We'll start by getting a customer, salesperson,…and product for this order.…We're not going to be particular in this case,…so we're just going to get the first one from the database.…Now we'll create the new order in code.…
We'll set the customer, the salesperson, what they ordered.…They've ordered a single item: the product from earlier.…And we'll indicate that the order date is right now.…Now that we have the order,…we can add it to the orders collection.…We've made the change to our Entity Framework model,…but we haven't saved that change to the database…until we call context.SaveChanges.…Now that we've saved the changes to the database,…the generated values from the database…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.