Closed Defee closed 2 years ago
Hmm... It looks like ConfigureServices
isn't getting called, but I'm not sure why just from the code you provided. Any hints in the verbose output? If not, could you share a full repro so we can investigate on our end?
As workaround, you could try adding implementations of IDbContextFactory<TContext>
in your startup project, but we should still try and understand the underlying issue.
OK. Will create repo and push today.
@bricelam, here is the repository where you can reproduce Issue: https://github.com/Defee/EF.Packages.Issue
I've found the issue that causes this strange behaviour:
If context has only constructor with DbOptions
This is a duplicate of #6826
Hi bricelam , do you able to find solution for "# ConfigureServices" isn't getting called
@nambir - Remove parameterless ctor from your DbContext that should fix it.
Issue: Run the migrations with the contexts located in the packages.
I have a web project. I also have many separate DbContexts. I want my web project to manage contexts. So, I want to store migrations in the web project. And contexts
After I ran the dotnet ef dbcontext list,I have following contexts listed:
odec.Server.Model.Auction.Contexts.AuctionContext odec.Server.Model.OrderProcessing.Contexts.EntireMoneyProcessingContext odec.Server.Model.OrderProcessing.Contexts.OrderContext odec.Server.Model.Work.Contexts.WorkContext odec.CP.Server.Model.User.Membership.Simple.Contexts.UserContextExt odec.Server.Model.Personal.Store.Contexts.PersonalStoreContext odec.Server.Model.Store.Contexts.Blob.StoreContext
But i have the issue running following command:
dotnet ef migrations add 'WorkInitial'-c 'odec.Server.Model.Work.Contexts.WorkContext' -o .\Data\Migrations\Work --verbose
It results in the exception below (the context has required things, so, I don't know what is that about). Below is complete listing. Please, help to figure out what is wrong.PS output
Project Json
appsettings with connection string:
Configuration in Stratup.cs
Note
I tried to run migrations when web project and context projects are within solution. It worked. Feel free to use the odec.* packages in project.json to reproduce. (they are published on NuGet)