I am trying to convert a Method Syntax to Query Syntax.
Class Structure is nested like this:
- Property
- PropertyParty
- Party
- PartyMailingAddress
- PropertyMailingAddress
It seems MethodSyntax (first one), is bringing less rows grouped together compared to Query Syntax, bringing more rows .
How do I fix second Query syntax to be equivalent to Method Syntax?
var result = db.Property.Include(pm => pm.PropertyParty)
.Include(pm => pm.PropertyParty)
.ThenInclude(x => x.Party)
.ThenInclude(x => x.PartyMailingAddress)
.ThenInclude(x => x.PropertyMailingAddress)
.ToList();
var testingResult = (from property in db.Property
join propertyParty in db.PropertyParty
on property.PropertyId equals propertyParty.PropertyId
join party in db.Party
on propertyParty.PartyId equals party.PartyId
join partyMailingAddress in db.PartyMailingAddress
on party.PartyId equals partyMailingAddress.PartyId
join propertyMailingAddress in db.PropertyMailingAddress
on partyMailingAddress.PartyMailingAddressId equals propertyMailingAddress.PartyMailingAddressId
select property).ToList();
*If there is no equivalent, could I grab the query results, and group them to be similar to Method Syntax?
The Query syntax answer should Not contain ThenInclude
Currently using Net Core 2.2