Say I have Table A that has many Table B’s. Table B has only one Table A.
Now say Table B has a property called Name. How can I do the following in linq.
Get all Table A’s where Table B has Name == “bob” then get all Table B’s inside table A.
Example
Table B
Name TableA_Id
bob 1
bob 1
bob 1
jim 1
jon 2
So if I would a query I would want one Table A object back with 3 Table B objects within it.
I tried
session.Query<TableB>().where(x => x.Name == "bob").select(x => x.TableA)
session.Query<TableA>().where(x => x.TableB.where(d => d.Name == "bob") // can't do this since it is a collection
I can’t do either of these as it either does not compile or it returns To many TableA (I think) what is giving me unexpected results.
I believe you can do: