Use EF Core 2.1 Seed feature in "Create an MVC web app" tutorial #9282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #9205
Updated the Create an MVC web app tutorial to use EF Core 2.1 Seed feature in MvcMovieContext instead of a separate SeedData class. The goal is to reduce the amount of code necessary to seed data and consequently decrease the complexity to beginners, also making the docs more didactic by introducing the EF core 2.1 seed feature.
MvcMovieContext
through EF core 2.1SeedData
in the v2.1 sample project to be able to insert the seed data in the database.MvcMovieContext
.MvcMovieContext
class instead ofSeedData
class (only in the 2.1 docs version).MvcMovieContext
class instead of theSeedData
class (only in the 2.1 docs version).SeedData
class as it is. No changes in the asp.net core <= 2.0 sample project or tutorial instructions.Feedbacks are welcome!
Thanks so much!