timd
New Member
Posts: 1
|
Post by timd on Mar 21, 2012 21:20:46 GMT -5
This is my SQL, which executes fine:
select farm_id from tbl_farm f inner join tbl_UserAccountAccessibleFarm uaaf on uaaf.UserAccessibleFarm_ID = f.Farm_ID where farm_number=8065 group by farm_id having count( uaaf.useraccount_id )=1
It produces the following LINQ but gives me the error: "Error Compiling Expression: Error Compiling Expression: 'MG.MGFarmEFDAL.MGFarmDB.Farm' does not contain a definition for 'UserAccount_ID' and no extension method 'UserAccount_ID' accepting a first argument of type 'MG.MGFarmEFDAL.MGFarmDB.Farm' could be found (are you missing a using directive or an assembly reference?)"
Generated LINQ:
from f in _Context.Farms join uaaf in _Context.UserAccountAccessibleFarms on new { UserAccessibleFarm_ID = f.Farm_ID } equals new { UserAccessibleFarm_ID = uaaf.UserAccessibleFarm_ID } where f.Farm_Number == 8065 group f by new { f.Farm_ID } into g where g.Count(p => p.UserAccount_ID != null) == 1 select new { Farm_ID = (Int32?)g.Key.Farm_ID }
|
|
|
Post by Mikhail Oumantsev on Mar 23, 2012 0:30:44 GMT -5
When I convert a similar SQL against Nortwind database, it works fine. Please send me your dbml and designer.cs files to debug.
|
|