I’m trying to map a custom entity to a set of stored procedures. The properties on the entity correspond to the parameters of the insert and update procs as well as the select proc used in the function import. I get the following error for all the properties on my entity object when I open the EDMX file in XML view:
Error 11009: Property ‘xxx’ is not mapped.
I searched this error on Google and some forums suggested that Entities can only be mapped to tables; custom entities are not permitted to be mapped to stored procedures.
Can custom entities be mapped to stored procedures without mapping to a table in a database? If not, what would be the best approach using the Entity Framework to solve this issue? My initial thought is to create a complex type and then use function imports for all the CRUD methods.
You can have a store procedure that returns a complex type in the entity framework, but I think complex types cannot have store procedures mapping. If you want to do something with store procedures, you can create function imports and call your store procedure.
The tool will create a method with all the parameters you need to call your store procedure, if the procedure returns a select you can either do a mapping to a existing Entity or create a new complex type.