locked
The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'

    Question

  • I have the below query code:

    var
     query = from
     technologyCategory in
     connection.TechnologyCategory
                                join
     category in
     connection.Category on
     technologyCategory.Category equals
     category.ID
                                where
     technologyCategory.Technology == 5
                                select
     category;
    
    When I compile I receive the error message "The type of one of the expressions in the join clause is incorrect.  Type inference failed in the call to 'Join'".  The column technologyCategory.Category is actually technologyCategory.Category_ID but since it is an FK to category.ID EF makes it technologyCategory.Category.  Also, I looked at the mappings in the .edmx file and they look correct.  However, the one thing I did see is in the entity for table TechnologyCategory the column Category_ID has nothing in the Value/Property column and there is no way for me to set it.
    • Edited by RandomBen Tuesday, January 19, 2010 6:01 PM cleaned up
    Tuesday, January 19, 2010 6:00 PM

Answers

  • I worked on the code since I posted and I figured out that I needed to make

    equals
    
    category.ID
    into
    equals
    
    category
    As the ID of the category table is inferred so I don't need to declare it specifically.  Thanks for looking at my question!


    • Marked as answer by RandomBen Tuesday, January 19, 2010 9:12 PM
    Tuesday, January 19, 2010 9:12 PM