You must Sign In to post a response.
  • Category: LINQ

    Get Foreign key relationship dynamically

    I want to know is there any method in "Linq/ Entity framework" to identify the relationship exists between two entities. For Example:
    I have a string which contains DB entities separated with comma as shown ("Employee,Department"). I want to compare the Employee and Department to know is there any relationship exists.
  • #752604
    Why can't you use LINQ to SQL in this case? If you are new to this please go through the MSDN tutorials:

    Asheej T K

  • #753319
    In order to get relationships of a particular object , you need to get the RelationShipManager reference in code using following syntax and then check the HasRelationships property to know if the relationship exists.


    Relationship manager identifies the relationship between different entities.

    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • Sign In to post your comments