none
Entity framework code first, assocation table receiving multiplicity error RRS feed

  • Question

  • I have an association table that has an additional column, so I have broken it out into two separate classes, on this table there is no primary key but they are both foreign keys to their respective tables.

    I was told if I want access to that additional column then I should split them and treat them as a one to many instead of a many to many, so I have done that, but now I am receive the following error:

    Multiplicity is not valid in Role 'Table A' in relationship 'Table B'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be '1'.

    I did look on here first for a solution and someone else did have the same problem, but they solved it in email.

    Thanks in advance for the help.

    • Moved by Robin_Yang Thursday, July 25, 2013 7:31 AM
    Wednesday, July 24, 2013 11:36 PM

All replies

  • Hello,

    Welcome to MSDN Forum !

    According to your description, I know that you encounter some issue about Entity framework code first,I think this post is in a wrong place, I have moved your post to Data Platform Development forums, you need to  create a new post there  .

    Data Platform Development forums:   http://social.msdn.microsoft.com/Forums/en-US/home?category=dataplatformdev

    This moderator and community will be glad to help you .Hope these helps, if you have any problems, please feel free to let me know.

    Best Regards,

    Lilia


    Lilia Gong
    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.

    Thursday, July 25, 2013 8:11 AM
  • I think the issue might lie in the fact that the association table's columns are as such:

    idNameA (PK) | idNameB (PK) | Total

    And that the multiplicity is occurring because I am mapping from a Primary Key to a Primary Key. I know the models themselves are setup correctly as there will be many results to each Table A or Table B, but the problem lies in the mapping. Any help is greatly appreciated.



    • Edited by gregwhitworth Thursday, July 25, 2013 4:20 PM It removed the single line breaks so I inserted pipes to make it better.
    • Proposed as answer by Lilia gong - MSFT Monday, August 5, 2013 12:36 PM
    Thursday, July 25, 2013 4:19 PM