none
EF 6.0 Error 10021: Duplicated ResultMapping element encountered RRS feed

  • Question

  • This is copy of my question posted in StackOverflow @ http://stackoverflow.com/questions/17455996/ef-6-0-error-10021-duplicated-resultmapping-element-encountered

    I am researching EntityFramework 6 (pre) for upgrading an existing project/site.
    I am trying to see if I can use already developed stored procs as part of a phased approach.
    The existing project uses many storedprocs that return more than 1 result set. 

    Using EF 6.0 and the database-first approach, I had the code generated using the wizard, and I used the http://msdn.microsoft.com/en-us/data/JJ691402.aspx article to hand edit the .edmx file to look like this:


        <FunctionImportMapping FunctionImportName="sps_GetResults" FunctionName="myDbModel.Store.sps_GetResults">
        <ResultMapping>
        <ComplexTypeMapping TypeName="myDbModel.sps_GetResults_HeaderResult">
        <ScalarProperty Name="CaseType" ColumnName="CaseType" />
        <ScalarProperty Name="SurgeryType" ColumnName="SurgeryType" />
        </ComplexTypeMapping>
        </ResultMapping>
        <ResultMapping>
        <ComplexTypeMapping TypeName="myDbModel.sps_GetResults_DetailResult">
        <ScalarProperty Name="PartNumber" ColumnName="PartNumber" />
        <ScalarProperty Name="Name" ColumnName="Name" />
        <ScalarProperty Name="Qty" ColumnName="Qty" />
        <ScalarProperty Name="Price" ColumnName="Price" />
        <ScalarProperty Name="PriceType" ColumnName="PriceType" />
        </ComplexTypeMapping>
        </ResultMapping>   
        </FunctionImportMapping>

    NOTE: I have made changes as mentioned in the above article adapting to my needs to use ComplexTypes instead of EntitySet. But VS2012 is not able to compile and throwing the error
        Error 4 Error 10021: Duplicated ResultMapping element encountered. C:\Working\App8\Model1.edmx 55643 11 App8

    Please let me know what I missed.

    Thanks

    Wednesday, July 3, 2013 8:01 PM

Answers

  • Chester,

    I think the editor was complaining about what it had in "memory". This error went away after I closed the solution and reopened it again.

    I will keep an eye for this in the future.

    Thanks

    Monday, July 8, 2013 4:47 PM

All replies

  • Hi Param,

    As the documentation said, "Editing the edmx file like this will work but it will also break the validation of the model in VS. So if you validate your model you will always get errors." The EDM designer isn't multiple result set aware so you will always get the error.

    You can try to test whether you will get any runtime exceptions.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Friday, July 5, 2013 9:35 AM
    Moderator
  • Chester,

    I think the editor was complaining about what it had in "memory". This error went away after I closed the solution and reopened it again.

    I will keep an eye for this in the future.

    Thanks

    Monday, July 8, 2013 4:47 PM
  • Hi Param,

    Thanks for sharing it.

    I'll temporarily mark the thread as answered. If there are any further problems, please feel free to update here.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

    Tuesday, July 9, 2013 1:32 AM
    Moderator