C
C#15mo ago
Bonda

❔ Entity framework core Fluent API

Hi all. I'm trying to add a migration but I get an error because EF Core can't bound constructor parameter "category" and the property "ProductCategory". I have added the required mapping in "OnModelCreating" inside my DbContext class but it doesn't seem to work. Am I missing something? I don't have any problem with other properties because their name coincide with constructor parameters. Thank you 🙂
3 Replies
Bonda
Bonda15mo ago
I know that I could rename the parameter name but I want to understand what is the problem here and if it is possible to do this kind of mapping.
Bonda
Bonda15mo ago
For now I have solved adding an empty constructor. It's an anti-pattern so if you have a better idea let me know.
Accord
Accord15mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.