InvalidOperationException: The required column 'Categoryid' was not present in the results of a 'FromSql' operation


Question: I can't see a Navigation Property called Categoryid anywhere in the Class Modal, where is Entity Framework getting this property from?

How do I resolve the error that says "InvalidOperationException: The required column 'Categoryid' was not present in the results of a 'FromSql' operation"?


Login to See the Rest of the Answer

Answer: If you are utilizing the Navigation Property in Entity Framework (ef core), you have to make sure the Object you have included in the Parent Object has a Niviation Property inside the Parent Object name as the Nested Object name then append an Id to it.

If EF Core does not find this Property, it generates one for you, that is why you cannot see a Property name called Categoryid inside your nested Object Class.






© 2024 - ErnesTech - Privacy
E-Commerce Return Policy