none
Error 2027 still occurring after stored procedure mappings added RRS feed

  • Question

  • We are upgrading an application from EF4 to EF6.  One entity in EF4 used a set of stored procedures for Add/Update/Delete.  Upgrading to EF6 caused the 2027 message:

        Error    1    Error 2027: If some of the EntitySet or the AssociationSet mapped to the same store EntitySet, and one of the sets includes a function mapping, all related entity and AssociationSets in the EntityContainer must also define function mappings. The following sets require function mappings: FK_Contact_Client, FK_Contact_AssociatedDevice, FK_Contact_DefaultZone.    C:\Development\Axxon\Axxon Monitoring Server\Axxon Data Model\Models\CoreData.edmx    5138    11    Axxon Data Model

    The original table with the Sprocs was Contact.  The Client, Device and Zone tables have all had sprocs added.  The relationships between them are all 0..1 to *. Add 3 sets of stored procedures and the additional mappings has had zero effect on the error message.  Clearly I am missing something.  Opening the model in XML shows the error associated with the very last relationship in the model, which has nothing to do with the 3 tables above.

    The section of the model looks like this with the three relationships highlighted:

    Oddly enough the model compiles while giving the error message, but then refuses to load when being run.

    Any clues as to how I can solve this?  We are on a deadline (of course) and this problem is stopping us from moving ahead with live field trials. 

    Thanks, Neil


    Neil M. Johnson

    Thursday, November 6, 2014 9:44 PM

Answers

  • And of course, moments after posting, and days after I started banging my head on this thing, I stumbled upon an answer.  The Delete sproc for contacts had 2 of the 3 related entity ids added as dummy parameters, but it did not have all of them.  The Delete Contact sproc required me to pass in the ContactID, DeviceID, ZoneID and ClientID in order to recognize that all of the sprocs were configured correctly.

    The error message 2027 was too cryptic to describe the actual problem.  Once I added the missing dummy parameters, the other errors around missing parameters on the insert and update sprocs then appeared and made much more sense. 

    It makes very little sense to me that an entity that is defined with a unique primary key, requires all additional related entities to be included in the delete sproc in order to delete it.   However, I leave that to the experts to figure out.

    Neil


    Neil M. Johnson

    Thursday, November 6, 2014 10:40 PM