Lazy loading is enabled by default. This means that the collections will be loaded when you access them, not when you retrieve the parent object e. G foreach (var parent in repo.GetQuery()) { foreach (var child in parent.
Children) { // do something } } If you wish to eagerly load your entities you could subclass your generic repository and override the methods where you wish to use the Include lambda. Alternatively there is an Include method that accepts a string list of associations to include, which you could expose on your generic repository Update: Not quite sure why you gave my answer -1 but as further clarification You stated regarding your GetQuery() method: I get back the entire entity including all child entities The child entities are lazily loaded, whether you access the collections in debug or output them on your page The single query should work, with lazy loading enabled And AFAIK, with lazy loading disabled, this doesn't mean that all the collections are loaded automatically, quite the opposite, you have to explicitly load them by calling Include.
Lazy loading is enabled by default. This means that the collections will be loaded when you access them, not when you retrieve the parent object e.g. Foreach (var parent in repo.GetQuery()) { foreach (var child in parent. Children) { // do something } } If you wish to eagerly load your entities you could subclass your generic repository and override the methods where you wish to use the Include lambda.
Alternatively there is an Include method that accepts a string list of associations to include, which you could expose on your generic repository. Update: Not quite sure why you gave my answer -1 but as further clarification. You stated regarding your GetQuery() method: I get back the entire entity including all child entities.
The child entities are lazily loaded, whether you access the collections in debug or output them on your page. The single query should work, with lazy loading enabled. And AFAIK, with lazy loading disabled, this doesn't mean that all the collections are loaded automatically, quite the opposite, you have to explicitly load them by calling Include.
In the comments, above, I state Lazy Loading is enabled. Also, in my question I state I get back the child entities when I run the GetQuery method. Once I add the where expression I do not get back child entities.
I further ask if I can get back all child entities without using the include method. – DDiVita Jun 28 at 19:31 @DDiVita But Lazy Loading enabled is what doesn't load them. If it's set to eager loading (lazyload off) then when you hit that row it should fetch everything associated with it.
If it's not, something isn't working right. – Tridus Jun 28 at 19:50 @DDiVita - I was answering the question in your comments. You asked "If it wasn't on, wouldn't my first, GetQuery(), not contain child entities" - I answered accordingly - "Only when you access the collection" - hence LAZY loading.So you either leave it on and iterate the collections or you eagerly load them with Include.
So, why the -1? – Ben Jun 28 at 21:58 @Ben - I apologize, but you are still not making any sense to me. Lazy loading is enabled for the entire context.
In my comments above, I was asking "If I really had it turned off, why would I still get all my child entities. " This meant, I most likely had it turned on. I do not wish to eager load.
I am not sure where the disconnect is or perhaps you are misunderstanding what I am try to say? – DDiVita Jun 28 at 23:53 @Ben - My question is: "Is there a way to get back ALL child entities without having to write includes for each entity?" I set the -1 because I thought you didn't read the whole post.
If I set lazy loading to OFF, then my GetQuery doesn’t bring back child entities, as expected. If I keep it at the default, ON, then everything works on the GetQuery, until I call the Where expression.So, if there is an issue, what could it be? – DDiVita Jun 28 at 23:54.
If you wish to eagerly load your entities you could subclass your generic repository and override the methods where you wish to use the Include lambda. Alternatively there is an Include method that accepts a string list of associations to include, which you could expose on your generic repository. Not quite sure why you gave my answer -1 but as further clarification.
All child entities. The child entities are lazily loaded, whether you access the collections in debug or output them on your page. The single query should work, with lazy loading enabled.
And AFAIK, with lazy loading disabled, this doesn't mean that all the collections are loaded automatically, quite the opposite, you have to explicitly load them by calling Include.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.