I have run into a pain point with Entity Framework's code first approach and, as of this week, have been delighted to learn that it is not a bad as I am making it out to be in my head. The fact that I've not yet worked professionally on a team that does the code first thing leaves me in the dark, but now there is a little more light thanks to a talk by Julie Lerman at the AngularMix conference. Alright, as I already knew, you have to have a migration script to update the database. I did not realize how easy it was however. This has some steps and per Julie's talk this would be a good command line command to make the first script:
- dotnet ef migrations add init
It's gonna make some gunk inside of your Visual Studio solution (looks like C#) in one file that you may just run from there with this command line command:
- dotnet ef datatable update
Build your solution afterwards like so:
- dotnet build
I'm sure these commands vary a bit, and especially so when you update the initial script. The second of the links I provide here seems to have a bit different syntax than what Ms. Lerman showed off. Ms. Lerman has a bunch of Pluralsight content/trainings on Entity Framework too. I would imagine they get into this subject as well.
No comments:
Post a Comment