예제 #1
0
        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);
            }
        }
예제 #2
0
 public ILoadedObjectData GetOrLoadRelatedObject(RelationEndPointID relationEndPointID)
 {
     ++NumberOfCallsToLoadRelatedObject;
     return(_decorated.GetOrLoadRelatedObject(relationEndPointID));
 }