Last post Sep 04, 2020 03:12 PM by ddelella-regal
Sep 03, 2020 10:26 PM|ddelella-regal|LINK
.Join(this.PartInformation, p => p.PartId, pi => pi.PartId, (p, pi) => new
I am in a DbContext for my database. I want to join the part id of one table to the part if of another table to get some information about the part. However, when I go to put in the lambda query, I tried the linq sql version too, I get the error, "No overload
method for join takes 4 arguments". I have seen lots of examples of this type of query online. What is wrong with the above?
I am using .NET 4.6.2, EF6.4, and SQL Server 2016. It seems to act like the join is for a string because it is looking for method Join(separator).
Sep 04, 2020 03:04 AM|yij sun|LINK
Accroding to your description and codes,I have create a test and I couldn't reproduce your problems.Your problem means the function has no version with 4 parameters. Linq Join method has 5 parameters.
Could you tell us where do you write these codes in your project?You could check wheather exist 'this.Parts' and 'this.PartInformation'.
Sep 04, 2020 01:36 PM|ddelella-regal|LINK
JOIN actually has only 4 arguments (parameters). The 5th one listed is a "this" type indicating it stands for the value on the left side of the Join call. The exact document I copied my example from is the Entity Framework homepage:
They even show a working example that I followed to the letter but still nothing is working.
Sep 04, 2020 03:12 PM|ddelella-regal|LINK
I found the problem. Apparent, I made the PartId of the Parts class a string but the PartId of the PartInformation class was an integer. Instead of telling me that the join condition had non-matching data types it gave me a cryptic error for invalid number
of arguments. Once I fixed the data types it worked fine.
I hope this solution helps someone.