This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, We have a hierarchical model called Document, which has a Parent and a Children collection referring to itself. We know that LightSpeed eager loading does not support this and understand why. However we have other indexes of the data and are able to load all of the documents required for an entire branch of the tree in a single query. When we load the list of documents, the Children collections are not wired up, presumably because LightSpeed would have no way to know that we'd loaded all of the children required. Is there any way for us to manually fill the child collections and tell LightSpeed to trust us? This would be a huge performance win for us. Thanks Barry |
|
|
Hi Barry, No there isn't a mechanism to support this Im afraid. Ill have a look at whats involved with this though in case its something we can sensibly provide some access for.
|
|
|
Hi Jeremy, thanks for having a look. Do you have any idea how likely this is and is there anything we can do to help? If not I'll have to look at alternate solutions very soon. |
|
|
Ill be trying to implement something here this week but it may lead to other problems so I cant make any promises here but I will be able to let you know if this is possible by the end of the week, on the assumption its viable we should also either have a private build or something available to merge into the nightlies by then.
|
|
|
Thanks Jeremy, will be watching with interest :) |
|
|
Hi Barry, On further investigation I believe I have found a mechanism which might cover what you want within the existing framework. Ill explain it and then let you see if it covers what you are after. Under the covers child collections are managed within a managed container called an EntityCollection (you will see an EntityCollection This flag is exposed but it needs to be accessed directly against the field on the entity itself as touching the collection would trigger a lazy load, so to do this we could set up a method such as:
Keep in mind that if you assign entities which were not otherwise assigned they will be wired up accordingly and those changes will be persisted on a call to SaveChanges(). Additionally if you dont assign objects which are assigned according to the database that these will turn up if you later load the collection normally which triggers a database fetch. Have a look and see if this will cover off what you are after.
|
|
|
Hi Jeremy, I'd had a look at those properties and wondered, but wasn't sure how much I was going to confuse the framework. It sounds like it will do exactly what we need, and I understand the tradeoffs you mention. I'll try it out and let you know how we I get on, thanks for taking the time to look in to it. Barry |
|
|
Hi Jeremy, this is working really well for us, thanks! |
|