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 all, I'm running into an issue I can't seem to solve, and could use some help. I'm still on LS 1, and I'm performing 2 queries on the same object/table consecutively. The first selects the newest record, the second can potentially select the same record. The object contains a large XML string that I do not load except when using explicit Aggregate functions on the query object. Here is the basic jist of what's happening.
Bar bar; //get the maximum //doesn't load Xml Foo max = fooService.validate(bar); //Does load xml as it will be updated Foo updated = fooService.getUpdatableFoo(bar);
in the situation where "max" and "updated" both have the same Id, LS is returning me the instance that was loaded form the validate service invocation. I understand this is an efficiency issue, but not the behavior I want in this usage as it doesn't load the XML. Is there a way to tell LS to reload the object graph from the DB when getUpdatableFoo is called?
Thanks, Todd
|
|
|
This isn't a way to do this, but from your description I'm not sure it matters. The XML string will be loaded from the database when you access the relevant property anyway (subject to the note below). Granted, this may mean two trips to the database (one abortive trip in getUpdatableFoo, and a subsequent trip to get the XML string), but this should be a fairly insignificant overhead unless you are doing a lot of these queries *and* max and updated are frequently the same object. Is that your scenario? Note that in order to load a lazy field after object creation (i.e. to load on property get rather than requiring the aggregate at initial load time), the property getter must be implemented using Get rather than as a raw field access. |
|
|
Hi Ivan, I'm not sure I follow you, here is how the field is Accessed in afterLoad
protected override void AfterLoad() hence I can't access the Points property as they're parsed from XML
Even if I do the following
//Does load xml as it will be updated Foo updated = fooService.getUpdatableFoo(bar); updated.XmlPoints
The value never gets retrieved from the DB.
I have this on my field [EagerLoad(AggregateName = "GroupWithTracksWithPoints")] and this on my query object
Query query = new Query(typeof(Track));
|
|
|
Can you post the implementation of the XmlPoints property? Thanks! |
|