locked
Code First Migrations RRS feed

  • Question

  • I want update database but it doesn't allow me to update, what would be the right command for this?

    This is the error i'm getting  : ObjectNotFound: (update-database-force:String) [], CommandNotFoundException

    • Moved by Fred Bao Monday, July 21, 2014 2:07 AM
    Saturday, July 19, 2014 2:55 PM

Answers

  • Hello,

    >>I want update database but it doesn't allow me to update, what would be the right command for this?

    From your title, I assume that you are trying to update your database with migrations using Package Manager Command. Is it right?

    Then after you add a migration to you database, you just need to run command as “update-database” is ok. If you want to see the generated script add –verbose.

    >>This is the error i'm getting  : ObjectNotFound: (update-database-force:String) [], CommandNotFoundException

    For this error, it might be that EF module is not loaded in nuget console for some reasons.

    You can use the following similar command to import the EF module.

    Import-Module C:\Work\branches\v1\src\packages\EntityFramework.5.0.0\tools\EntityFramework.psd1

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Fred Bao Monday, July 21, 2014 5:37 AM
    • Marked as answer by Fred Bao Monday, July 28, 2014 9:45 AM
    Monday, July 21, 2014 3:32 AM