sql - Linq Many to many -
could please linq problem.
users have list of properties , properties have list of users.
i first query properties particular companyid. makes new list we'll call myproperties.
i need tenants have property in myproperties list.
for other reasons, don't have access "propertiesusers" join table.
sorry if looks haven't thought through, i've been banging head day on it.
you can use enumerable.selectmany()
flatten hierarchy:
var myproperties = dbcontext.properties.where(property => property.companyid = companyid); var tenants = myproperties.selectmany(property => property.tenants);
Comments
Post a Comment