Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbContext not found #9274

Closed
qvsmith opened this issue Jul 27, 2017 · 0 comments
Closed

DbContext not found #9274

qvsmith opened this issue Jul 27, 2017 · 0 comments

Comments

@qvsmith
Copy link

qvsmith commented Jul 27, 2017

I cannot seem to add migrations from third party lib's DbContexts (IdentityServer4.Entityframework). I'm getting error in title.
(My custom DbContext was found and I was able add migrations for it.)

Steps to reproduce

I followed this short tutorial's 'Starting from scratch...' section: http://benjii.me/2017/05/enable-entity-framework-core-migrations-visual-studio-2017/ with the only difference being that I'm trying to use efcore for pgsql .

Repro project: https://github.com/qvsmith/migration-issue-repro

Screenshots:
Firing dotnet ef command from DataAccess project path
image

Firing same command as above with startup project specified
image

So from issue #5320 I have to specify the startup project to execute migration commands and then it doesn't find the other two DbContexts.

I'm probably missing something but, I have no idea what.

Update
From the author's site in an earlier article on EF Core migrations he noted this error:
"No parameterless constructor was found on 'TContext'. Either add a parameterless constructor to 'TContext' or add an implementation of 'IDbContextFactory' in the same assembly as 'TContext'." (emphasis mine).

That could maybe explain why it's not picking up the other DbContexts. Just not sure why it picks them up when running dotnet ef command from DataAccess project path.

Update 2
After chatting with @bjcull I've come to the conclusion that the issue I'm having is most likely with Npgsql.EntityFrameworkCore so will open an issue there (seeing as I can add the migrations when using SqlServer).

Seeing as I could add the one migration using the dotnet ef startup project option I guess I'm just missing a library in my .NET Standard class library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants