Skip to content
New issue

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

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

Already on GitHub? # to your account

EfCoreValueConverter missing parameterless constructor #116

Closed
PoolPirate opened this issue Apr 25, 2022 · 1 comment
Closed

EfCoreValueConverter missing parameterless constructor #116

PoolPirate opened this issue Apr 25, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@PoolPirate
Copy link

Describe the bug

In order for the value converter to work in the HaveConversion method a parameterless constructor is needed.
Currently trying to use the converter will throw

System.InvalidOperationException: "Cannot create an instance of value converter type 'EfCoreValueConverter'. Ensure that the type can be instantiated and has a parameterless constructor, or use the overload of 'HasConversion' that accepts a delegate."

In contrast the StronglyTypedIds lib does provide a parameterless constructor in the source generated converter which does solve this issue.

Steps to reproduce

  1. Install latest version of EFCore (6.0.4) and Vogen (1.0.19)
  2. In the DbContext override ConfigureConventions and configure a conversion with the source generated converter.
  3. Create / Apply migrations will throw

Expected behaviour

The value converter should come with a default parameterless constructor.

@SteveDunn
Copy link
Owner

Many thanks for reporting @PoolPirate . I'll take a look. I can also see you've submitted a PR, so many thanks for that too! I'll take a look now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants