sql - Fluent Linq: Get he contents of Table1 where entry in Table2 -
using linq fluent syntax, how contents of table1 using foreign key table 2. example given tables
tblpropertyextras tblextra propertyextraid extraid propertyid extraname extraid
i trying equivalent of sql
select tblextra.* tblpropertyextras inner join tblextra on tblpropertyextras.extraid = tblextra.extraid propertyid = 1234
(extra part :is there converter sql linq can use while annoyingly bad linq?)
this should work you:-
var result = db.tblpropertyextras.join(db.tblextra, pe => pe.extraid, e => e.extraid, (pe, e) => new { pe, e }) .where(x => x.pe.propertyid == 1234) .select(x => x.e);
although not fan of method syntax when comes joins. prefer query syntax instead:-
var result1 = pe in db.tblpropertyextras join e in db.tblextra on pe.extraidequals e.extraid pe.propertyid == 1234 select e;
Comments
Post a Comment