HasOne Linq select query issue #3287
-
Hi, We have an issue when using a one to one(or zero) relationship in our codeFor example we have a class Parent and class Child which have one to one or zero relation This the Parent class :
This is the Child class
This is the mapping we use for the parent class
This is the mapping we use for the child class
Then we try getting all the parent records with their child records. The problem is that when we query the database using
When we use
Can someone please help us on this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
I am having the same issue. Problem is, parent entities are queried in quite a lot of locations, project is maintained by a team of developers and new queries may pop up any day. Also, info contained in child is needed only for a fraction of scenarios. I have tried adding Can this be achieved somehow with mapping? My effort to google this led nowhere. UPDATE: |
Beta Was this translation helpful? Give feedback.
return Session.Query<Parent>().Fetch(x=>x.Child).ToList();