❔ Ef Core Constructor problem
Hello its my first big project with ef. I have an class with 3 attributes and one constructor that is calling the base constructor. My Class inherit from another class.
The problem is that ef core need an parameter less constructor. I tried to add an private constructor but its not working.
8 Replies
Add a public parameterless constructor
Or better yet, just remove the constructors you have and use
required
properties insteadthe problem is that i need the constructor because the class i inherit from is a nuget
public constructor
this means that it tries to call the constructor but i dont have parameters
Remove ctor from that class as well
Or just add a public parameterless ctor, that should work as well
the class i inherit from(nuget paket) is inheriting from another class...
it wont work
i need the constructor
the picture above show an error when i add public parameterless ctor
One thing that comes to mind, is creating your own class that mirrors what the class from the nuget contains, use that class with EF, and just map between them as needed
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.