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

New Option "No parameterless constructor" #1040

Closed
DannySotzny opened this issue Jul 4, 2021 · 4 comments
Closed

New Option "No parameterless constructor" #1040

DannySotzny opened this issue Jul 4, 2021 · 4 comments

Comments

@DannySotzny
Copy link

DannySotzny commented Jul 4, 2021

If I create the DBContext from an existing database (I always do this after a change) then a StandardConstructor is created with parameters and without parameters. Whereas the one without parameter is not used. (Reverse Engineer)

But when using AddDbContextPool ( ms docs ) there must be only one constructor (with or without parameter).

It would be great if there was an option to not automatically generate the parameterless constructor. The error occurs unfortunately only at runtime

Steps to reproduce

Use AddDbContextPool instead of AddDbContext

Visual Studio version: Visual Studio 2019 16.9 (latest)

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 4, 2021

Duplicate of #991 which is fixed in EF Core 6 - but a PR to fix this would be most welcome, given the increasing number of users hitting this.

@ErikEJ ErikEJ changed the title New Option "No default Constructor (with no parameter)" New Option "No parameterless constructor" Jul 4, 2021
@ErikEJ
Copy link
Owner

ErikEJ commented Jul 4, 2021

A sample PR for adding anew option: https://github.com/ErikEJ/EFCorePowerTools/pull/728/files

@ErikEJ
Copy link
Owner

ErikEJ commented Jul 11, 2021

Fixed in latest daily buidl: b85c77d

@ErikEJ ErikEJ closed this as completed Jul 11, 2021
@ErikEJ
Copy link
Owner

ErikEJ commented Aug 28, 2021

@0xced FYI!

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