Get() public static method

public static Get ( IEnumerable idArray ) : IEnumerable
idArray IEnumerable
return IEnumerable
Beispiel #1
0
 public static IEnumerable <NodeHead> Get(IEnumerable <string> pathSet)
 {
     foreach (var head in pathSet.Select(p => NodeHead.Get(p)))
     {
         yield return(head);
     }
 }
Beispiel #2
0
 private void ResetGroupIds()
 {
     _protectedGroupIds = new Lazy <int[]>(() => _protectedGroups
                                           .Select(gp => NodeHead.Get(gp)?.Id)
                                           .Where(gid => gid.HasValue)
                                           .Select(gid => gid.Value)
                                           .ToArray());
 }
Beispiel #3
0
        internal static Stream GetBinaryStream(int nodeId, int versionId, int propertyTypeId)
        {
            BinaryCacheEntity binaryCacheEntity = null;

            if (TransactionScope.IsActive)
            {
                binaryCacheEntity = DataProvider.Current.LoadBinaryCacheEntity(versionId, propertyTypeId);
                return(new SnStream(binaryCacheEntity.Context, binaryCacheEntity.RawData));
            }

            // Try to load cached binary entity
            var cacheKey = BinaryCacheEntity.GetCacheKey(versionId, propertyTypeId);

            binaryCacheEntity = (BinaryCacheEntity)DistributedApplication.Cache.Get(cacheKey);
            if (binaryCacheEntity == null)
            {
                // Not in cache, load it from the database
                binaryCacheEntity = DataProvider.Current.LoadBinaryCacheEntity(versionId, propertyTypeId);

                // insert the binary cache entity into the
                // cache only if we know the node id
                if (binaryCacheEntity != null && nodeId != 0)
                {
                    if (!RepositoryEnvironment.WorkingMode.Populating)
                    {
                        var head = NodeHead.Get(nodeId);
                        DistributedApplication.Cache.Insert(cacheKey, binaryCacheEntity,
                                                            CacheDependencyFactory.CreateBinaryDataDependency(nodeId, head.Path, head.NodeTypeId));
                    }
                }
            }

            // Not found even in the database
            if (binaryCacheEntity == null)
            {
                return(null);
            }
            if (binaryCacheEntity.Length == -1)
            {
                return(null);
            }
            return(new SnStream(binaryCacheEntity.Context, binaryCacheEntity.RawData));
        }