public void LoadLazyVirtualObjectEndPoint(RelationEndPointID endPointID) { ArgumentUtility.CheckNotNull("endPointID", endPointID); var virtualObjectEndPoint = GetRelationEndPointWithoutLoading(endPointID) as IVirtualObjectEndPoint; if (virtualObjectEndPoint == null) { throw new ArgumentException("The given ID does not identify an IVirtualObjectEndPoint managed by this DataManager.", "endPointID"); } if (virtualObjectEndPoint.IsDataComplete) { throw new InvalidOperationException("The given end-point cannot be loaded, its data is already complete."); } var loadedObjectData = _objectLoader.GetOrLoadRelatedObject(endPointID); var domainObject = loadedObjectData.GetDomainObjectReference(); // Since RelationEndPointManager.RegisterEndPoint contains a query optimization for 1:1 relations, it is possible that // loading the related object has already marked the end-point complete. In that case, we won't call it again (to avoid an exception). if (!virtualObjectEndPoint.IsDataComplete) { virtualObjectEndPoint.MarkDataComplete(domainObject); } }
public ILoadedObjectData GetOrLoadRelatedObject(RelationEndPointID relationEndPointID) { ++NumberOfCallsToLoadRelatedObject; return(_decorated.GetOrLoadRelatedObject(relationEndPointID)); }