Base solution for your next web application
Open Closed

Update-Database, Add-Migration vs Migrator #3080


User avatar
0
marble68 created

So I'm going through the Step-By-Step. The first time around, I did something wrong when trying to do Add-Migrations "Added_Phones" - That would never work. So I started trying to re-arrange my project so it looked like the samples to no avail.

I'm not an expert, so please forgive me if I'm asking dumb questions.

I am trying to do the Core-Angular2 version. The Angular4 project uses razor syntax, etc. and doesn't look anything like the step by step - so I'll stick with Ang2 version till I go through the step - by - step.

So I've started over - so I thought I'd ask a question (or two). I'm on VS 2017 - and I've downloaded the PhoneBook projects. I set my connection strings - but...

In the step by step is says to set the project to EntityFrameworkCore. There is no project by this name, so I presume it is Acme.PhoneBook.EntitryFramework? If that's correct, why don't any of the examples where Add-Migration or Update-Database, as shown in the step-by-step guide, work?

Opening the Package Manager Console - Update-Database gives me: The EntityFramework package is not installed on project 'Acme.PhoneBook.EntityFramework'.

So I go into the migrator and run the Acme.PhoneBook.Migrator.exe and everything works.

Should it already be installed? I found another thread where someone said "install this" <a class="postlink" href="https://www.microsoft.com/net/download/core#/current">https://www.microsoft.com/net/download/core#/current</a>

I've verified, in my Visual Studio 2017 setup, I have the .NET Core cross-platform development installed. So probably a dumb question, do I need to install the SDK as well?

Also - is it a bad idea to update all my nuget packages? I tried and it broke everything in the project, apparently.

Any advice is most appreciated. Thank you in advance, Chris


9 Answer(s)
  • User Avatar
    0
    marble68 created

    Ok - so in regards to update-database and add-migration...

    I see that I must do dotnet ef commands

    So to add a migration Dotnet ef migrations add {Added_Phones} then dotnet ef database update

    Those two commands seem to do the trick for me.

    Now - I'm trying to determine why Visual Studio doesn't like EnsureLoadedAsync.

    Is there a reference or something I'm missing or not referencing? The only reference I can find is under monodevelop?

    I downloaded the samples master from Github but I'm not seeing any references. It's error message is different - almost as if it's not being used correctly.

    Any guidance on EnsureLoadedAsync would be appreciated.

  • User Avatar
    0
    marble68 created

    I suppose this thread will be of use to someone.

    Updating the Abp packages seems to have brought the EnsureLoadedAsync functionality into play.

    Update your packages. doh!

  • User Avatar
    0
    mikemey01 created

    What version did you start with? I'm having similar issues converting version 3.2 to work with VS2017 (project.json - .csproj files) and getting EF to work. the CLI tool commands seem to no longer work with VS2017 projects and the package manager "Update-Database" don't work either.

    Did you update all 20 or so ABP packages? Or selectively update only a few?

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Your messages are a little long, but I think you have solved your problem :)

  • User Avatar
    0
    marble68 created

    mikemey01

    I am starting with Core & Angular v3.3

    Version 4 uses @razor syntax and the like - which I'm very pleased to see - but the step by step documentation is still based (roughly) on 3.3.

    For updating packages - I did them one at a time. I've had issues with VS and doing mass updates.

    FWIW - The one package that gave me fits was Abp.Hangfire - it kept mucking up a dependency. I had to go back and forth with them to get them to all update nicely.

    But I have everything working - except I had to modify the code a little bit.

    After updating nuget packages, there were several places where it was trying to pass the an identity result to a check errors functions - and the compiler did not like it. :)

    For example: CheckErrors(await CreateAsync(tenant));

    for now - I just remove the CheckErrors wrapper.

    Somethings different. I see there's a 3.4 - and I may pull that down and do a diff on the project.

    FWIW - at the bottom of the step by step is the link to the completed project - If you pull that down - there are some structural nuances that aren't exactly clear -seeing the end result helped me better interpret the instructions.

  • User Avatar
    0
    marble68 created

    <cite>hikalkan: </cite> Hi,

    Your messages are a little long, but I think you have solved your problem :)

    Sorry - I try and put as much information out as I can to be clear to anyone who might know the issue.

    Another reason is so my thread comes up in searches - That is extremely helpful for others if, like me, they search for specific commands and stuff.

    This is sort of my running 'newbie' thread - so I can ask my questions and post answers if I find them. It's a note to self that will hopefully help other people new to this as well.

  • User Avatar
    0
    marble68 created

    HIKALKAN - I do have a question:

    Where's the source to the nuget packages on github?

    Thanks! Chris

  • User Avatar
    0
    hikalkan created
    Support Team

    Thank you for your detailed explanations. Here the source code of Abp.* nuget packages: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate">https://github.com/aspnetboilerplate/aspnetboilerplate</a> and Abp.Zero* nuget packages: <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero">https://github.com/aspnetboilerplate/module-zero</a>

  • User Avatar
    0
    marble68 created

    Thank you!