|
Post by jneave on Mar 1, 2012 9:02:23 GMT -5
Hi,
I expect "Use Foreign Keys to simplify Linq" to turn this Linq:
join ownersystems in db.OurSystems on new { OwnerSystemID = chargebandnames.OwnerSystemID } equals new { OwnerSystemID = ownersystems.SystemID }
Into this:
join ownersystems in db.OurSystems on chargebandnames.OwnerSystem equals ownersystems
because there is a PK/FK relationship in the database. But it doesn't, I do that manually.
Is this what that setting is supposed to do or have I got this wrong?
Thanks,
James.
|
|
|
Post by Mikhail Oumantsev on Mar 7, 2012 0:47:27 GMT -5
This an example I use based on Northwind database. SELECT E.EmployeeID, ET.TerritoryID FROM Employees E JOIN EmployeeTerritories ET ON E.EmployeeID = ET.EmployeeID
Use Foreign Keys flag is off: from e in db.Employees join et in db.EmployeeTerritories on e.EmployeeID equals et.EmployeeID select new { EmployeeID = (System.Int32?)e.EmployeeID, et.TerritoryID }
Use Foreign Keys flag is on: from et in db.EmployeeTerritories select new { EmployeeID = (System.Int32?)et.Employees.EmployeeID, et.TerritoryID }
Please send me your connection files along with your SQL statement and will check it.
|
|