Sometimes I know I need to load additional sub-entities into an existing entity (or make sure they are prefetched regardsless if they were pre-loaded or not). I use the following code to realize this:
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchEntity(entityThatWasAlreadyLoaded, PrefetchPaths.GetPathForQuotationWithLinesAndSubObjects());
entityThatWasAlreadyLoaded.IsDirty = false;
}
PrefetchPaths.GetPathForQuotationWithLinesAndSubObjects is a method that composes a set of sub paths to fetch.
I noticed that the loading of additional sub objects works, but it will mark the owning object (entityThatWasAlreadyLoaded) as "Dirty" and this will cause 'out of sync' exceptions when reading the properties of the owning object. I have to explicitly set the owning object to IsDirty = false after the additional fetch, even though the data properties (fields) of the owning object should not be changed by this operation.
How should I go about loading additional data into a pre-loaded entity?
I'm using LLBL version 5.1 with SQL Server, Adapter model, no custom templates