Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Execute Seed Method #4384


User avatar
0
simedbn created

Hello,

I add new default values to a table and i need to execute seed method only , any idea ?

Thanks


11 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    If you created seed then run update-database from Package Manager Console.

  • User Avatar
    0
    simedbn created

    Update-Database No migrations were applied. The database is already up to date. Done. I need to make some changes in my Entities ?

  • User Avatar
    0
    aaron created
    Support Team

    You can run Add-Migration "Execute_Seed" to create an empty migration.

  • User Avatar
    0
    simedbn created

    Hello,

    PM> Add-Migration "Execute_Seed" To undo this action, use Remove-Migration. PM> Update-Database Applying migration '20171221220937_Execute_Seed'. Done.

    The seed method not running.

    Any idea plz ?

  • User Avatar
    0
    aaron created
    Support Team

    Where is your seed method called?

  • User Avatar
    0
    simedbn created

    Hello,

    It's called from InitialHostDbBuilder.Create from the SeedHostDb Helper

  • User Avatar
    0
    aaron created
    Support Team

    Well, doesn't the Host DB already exist?

  • User Avatar
    0
    simedbn created

    Yeah it's exist but i add new tables and i want to add some default values to those tables so i do the same as default languages but when i run the update database it's not working .

    I don't understand why because the first time i run the update database to create Database the seed method has been passed correctly but after that for every new migration when i run the update database i don t see the statement : applying seed method ...

    Should i try with the migrator app ?

  • User Avatar
    0
    aaron created
    Support Team

    Did you run your application?

  • User Avatar
    0
    simedbn created

    Yes the app it's running

  • User Avatar
    0
    simedbn created

    Hello,

    It's working now after reloading Visual studio :p .

    Thank you ^^