Does not reference any columns or members from the target entity.

Thread is closed for posting
2 posts, 0 answers
  1. Chris
    Chris avatar
    40 posts
    Member since:
    Feb 2009

    Posted 08 Feb 2012 Link to this post

    I have a many-to-many relationship between two tables: Packages and PackageSites. The relationship table is called Packages_PackageSites. I'm getting the following warning:

    The association for the join table with name 'Packages_PackageSites' does not reference any columns or members from the target entity.

    What does this error mean? When I double click on warning to take care of it, it asks me to select the join table columns that point to the child table. There isn't really a "child" table in a many-to-many relationship. Suggestions?

    I've noticed that PackageSite.Packages.Add(package) works, where as Package.PackageSites.Add(packageSite) does not. Does that have something to do with this?

  2. Zoran
    Zoran avatar
    534 posts

    Posted 10 Feb 2012 Link to this post

    Hi Chris,

     In the OpenAccess metadata, when you have a many-to-many association, even though logically, both association endpoints have equal meaning, one is always the lead part, or the source of the association. The other part of it is the target of the association. 

    We can definitely improve the validation message as the relation is really not a parent-child one but more a source-target one.

    The warning however, states that there are no columns in the join table that point to the target of the association. You should be able to pick those columns. If your Package and PackageSites entities have single Identity members(no multiple keys in the database) this warning will not affect the runtime of OpenAccess and you can just ignore it.
    In case there is single identity property, the OpenAccess runtime will automatically detect the join-table relation. That is actually the reasonwhy this is just a warning and not an error.

    You actual issue, that inserting Package.PackageSites.Add(packageSite) does not work, is probably caused by another setting. You should check the 'Managed' setting of your association endpoints, the IList<T> navigation properties in the designer. If you would like to be able to insert from both sides of the association, you should have both of those members marked with Managed=true. This is valid only if my assumption is true, that by "does not work", you mean that no data is inserted in the join table. If there is an exception on insert, than the reason is probably different and will need further investigation.

    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top