Esempio n. 1
0
        public IEnumerable <DataContainer> GetDataContainersWithLazyLoad(IEnumerable <ObjectID> objectIDs, bool throwOnNotFound)
        {
            ArgumentUtility.CheckNotNull("objectIDs", objectIDs);

            // GetDataContainerWithoutLoading below guards against invalid IDs.

            var objectIDsAsCollection = objectIDs.ConvertToCollection();
            // Note that the empty list check is just an "optimization": IObjectLoader works well with empty ObjectID lists, but it seems waste to go
            // through that whole call chain even if no IDs are to be loaded.
            var idsToBeLoaded = objectIDsAsCollection.Where(id => GetDataContainerWithoutLoading(id) == null).ConvertToCollection();

            if (idsToBeLoaded.Any())
            {
                _objectLoader.LoadObjects(idsToBeLoaded, throwOnNotFound);
            }

            // Since LoadObjects might have marked IDs as invalid, we need to use DataContainers[...] instead of GetDataContainerWithoutLoading here.
            return(objectIDsAsCollection.Select(id => DataContainers[id]));
        }
Esempio n. 2
0
 public ICollection <ILoadedObjectData> LoadObjects(IEnumerable <ObjectID> idsToBeLoaded, bool throwOnNotFound)
 {
     return(_decorated.LoadObjects(idsToBeLoaded, throwOnNotFound));
 }