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

accessing IRepository or other injected services from within a Migration #10013


User avatar
0
sedulen created

I have a need to modify data that already exists in the database, but the modification logic comes from a business rule in another service.

Is it possible to access an IRepository or another injected service from within a Migration? Are there any issues or drawbacks with this approach?

My alternative is to write a stand-alone application to perform the action that I need to, but I would rather not if possible.

Thanks.


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

    Hi @sedulen,

    As far as I know, it is not possible. But, you can do it in Seed classes which you can find under YourProjetcName.EntityFrameworkCore/Migrations/Seed or you can do it in Migrator project.