Original platform structure and link

I have a database that consists of the following elements:

** Table 1 **

  • Id (PK)
  • Field1

** Table 2 **

  • Id (PK)
  • Field2

** Link table **

  • Table 1Id (FK)
  • Table 2Id (FK)

The problem is that I cannot access Table 2 from Table 1, although the relationship exists in the database.

For example, the following should be possible:

var Results = from c in DataContext.Table1
              where c.Table2.Field2 == "Test"
              select c;

However, "c.Table2.Field2" is unavailable for any reason - all that I get for "c.Table2". is the following (among the standard any <>, where <> et al):

  • Relationship name
  • RelationshipSet
  • SourceRoleName
  • Targetgetolename

So, obviously, something is somewhere somewhere, but I can’t understand that!

Both tables exist in the entity schema and have the correct relationship between them.

+3
1

, c.Table2.Field2 , , c.Table2 , Field2. c.Table2 - , , . , , , :

var Results = from c in DataContext.Table1
              where c.Table2.Any(t2 => t2.Field2 == "Test")
              select c;
+2

Source: https://habr.com/ru/post/1732184/


All Articles