pekspro / EF-Migrations-Script-Generator-Task

24 stars 7 forks source link

It seems the Script Generator doesn't generate Script for DBContext Seeding? #4

Closed billytsoi closed 5 years ago

billytsoi commented 5 years ago

I find that the Code generator will generate scripts for migration but can it also generate scirpt for DBcontext It seems the Script Generator doesn't generate Script for DBContext Seeding?

https://docs.microsoft.com/en-us/ef/core/modeling/data-seeding

Please advise. Thanks a lot

pekspro commented 5 years ago

That is an interesting question! I’m not sure if this is possible so I will need to do some research. I’ll get back to you in a few days.

pekspro commented 5 years ago

Now I’ve played around with this and it seems to work :-). Please see the test application as a reference. Also note that you need to create a new migration (dotnet ef migrations add...) after you added seeding data in OnModelCreating.

billytsoi commented 5 years ago

Hey. Thanks a lot

Let me have a try.

Regards Billy Tsoi

On Sat, 7 Sep 2019 at 19:43, pekspro notifications@github.com wrote:

Now I’ve played around with this and it seems to work :-). Please see the test application as a reference. Also note that you need to create a new migration (dotnet ef migrations add...) after you added seeding data in OnModelCreating.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pekspro/EF-Migrations-Script-Generator-Task/issues/4?email_source=notifications&email_token=ADROFHUVXVRKW3F4QJVTBKDQIOHXTA5CNFSM4ITDSTYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6EW7SA#issuecomment-529100744, or mute the thread https://github.com/notifications/unsubscribe-auth/ADROFHW5JKGT6QQXW7YVXYTQIOHXTANCNFSM4ITDSTYA .