Error 2048: The entity set '[set name]' includes function mappings for association set '[fk name]', but none exists in element 'DeleteFunction' for type '[entity type name]'. Association sets must be consistently mapped for all operations.
I was confused, why do I need to have association mapping in the delete function? After a bit of searching and digging, here are the findings.
First, let's have a look at the two Entity models in question.
I have a 1-to-many relationship from left to right between ExceptionSource and ExceptionRepository. Besides, there is a self reference 1-to-many relationship on ExceptionRepository.
To avoid the mapping error 2048
To conclude, if you want to map custom stored procedures to Entity functions:
1) you must map all Insert/Update/Delete functions.
2) include the FKs in the delete function if any defined in the source table.
5 comments:
I like this phrase :)
This was driving me crazy. Thank you for posting this solution.
I hope this gets updated in the next version of EF. I can hear the DBA already yelling about adding dummy parameters!
thank you
An old post but still very helpful - thank you
Wow thank you so much for posting this. Even in 2014, your post is still useful!
Post a Comment