SenseNet.ContentRepository.Storage.DataBackingStore.GetBinaryStream2 C# (CSharp) Метод

GetBinaryStream2() статический приватный Метод

static private GetBinaryStream2 ( int nodeId, int versionId, int propertyTypeId ) : RepositoryStream
nodeId int
versionId int
propertyTypeId int
Результат SenseNet.ContentRepository.Storage.Data.RepositoryStream
        internal static RepositoryStream GetBinaryStream2(int nodeId, int versionId, int propertyTypeId)
        {
            if (TransactionScope.IsActive)
            {
                // Aktív tranzakció hekk
                var bce = DataProvider.Current.LoadBinaryCacheEntity(versionId, propertyTypeId);
                if (bce.RawData == null)
                    return new RepositoryStream(bce.Length, bce.BinaryPropertyId);
                else
                    return new RepositoryStream(bce.Length, bce.RawData);
            }

            // Nézzük meg a cache-ben ezt az adatot először...
            string cacheKey = string.Concat("RawBinary.", versionId, ".", propertyTypeId);

            var binaryCacheEntity = (BinaryCacheEntity)DistributedApplication.Cache.Get(cacheKey);

            if (binaryCacheEntity == null)
            {
                binaryCacheEntity = DataProvider.Current.LoadBinaryCacheEntity(versionId, propertyTypeId);
                if (binaryCacheEntity != null)
                {
                    if (!RepositoryConfiguration.WorkingModeIsPopulating)
                        DistributedApplication.Cache.Insert(cacheKey, binaryCacheEntity, new NodeIdDependency(nodeId));
                }
            }

            if (binaryCacheEntity == null)
                return null;
            if (binaryCacheEntity.Length == -1)
                return null;

            RepositoryStream stream;

            if (binaryCacheEntity.RawData == null)
                stream = new RepositoryStream(binaryCacheEntity.Length, binaryCacheEntity.BinaryPropertyId);
            else
                stream = new RepositoryStream(binaryCacheEntity.Length, binaryCacheEntity.RawData);

            return stream;
        }
        internal static Stream GetBinaryStream(int nodeVersionId, int propertyTypeId)

Usage Example

Пример #1
0
        public Stream GetStream()
        {
            var raw = RawData;

            if (raw == null)
            {
                return(null);
            }
            var stream = raw.Stream;

            if (stream != null)
            {
                return(CloneStream(stream));
            }
            if (OwnerNode == null)
            {
                return(null);
            }

            // Itt töltöm be, és adom vissza a Stream-et.
            // Ezt kéne megoldani úgy, hogy RepositoryStream-et adok vissza - a RepositoryStream-et ezek szerint VersionId - PropTypeId-val kell kezelni
            // A cache felelõsséget most átnyomom a DBS-re

            return(DataBackingStore.GetBinaryStream2(OwnerNode.Id, OwnerNode.VersionId, PropertyType.Id));
            //return DataBackingStore.GetBinaryStream(OwnerNode.VersionId, PropertyType.Id);
        }
All Usage Examples Of SenseNet.ContentRepository.Storage.DataBackingStore::GetBinaryStream2