Base solution for your next web application
Open Closed

Seed database using entity framework core #2277


User avatar
0
paymanrowhani created

Hi,

How can I seed my database using Abp.EntityFrameworkCore and Abp.Zero.EntityFrameworkCore? The startup template including module zero for .net core, shows how to seed db through entity framework 6 but I did not find any example for seeding db if I change ef6 to ef core.

Thanks, Payman


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Currently we don't have any example or documentation for that. Have you tried implementing it just like EF6 ?

  • User Avatar
    0
    paymanrowhani created

    Hi,

    I cannot be done like EF6 because of the changes listed in: <a class="postlink" href="http://blog.devart.com/migrating-entity-framework-6-projects-to-entity-framework-core-1-entity-framework-7.html#seeding">http://blog.devart.com/migrating-entity ... ml#seeding</a>

    I have tried some ways to handle it but they are not clean.

    Thanks, Payman

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks for the information. I will try this and let you know if I can find something.

  • User Avatar
    0
    exiled78 created

    @paymanrowhani did you find a solution? If so, would you mind posting your solution. I am also trying to do this by using an example from //see - <a class="postlink" href="https://github.com/rowanmiller/UnicornStore">https://github.com/rowanmiller/UnicornStore</a>

    but I am having trouble with the AbpDbContext throwing a NPE at CheckAndSetMayHaveTenantIdProperty

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    ABP does not support Entity Framework Core but we are currently working on it and actually it is almost completed. But we are not sure when it is going to be released because we have some other tasks to do for next release.

    You can get ABP from dev branch and try it with that if you like or you can wait for the next release.

    Thanks.