Пример #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);
        }
Пример #2
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);
            }

            if (this.OwnerNode.SavingState != ContentSavingState.Finalized)
            {
                throw new InvalidOperationException(SR.GetString(SR.Exceptions.General.Error_AccessToNotFinalizedBinary_2, this.OwnerNode.Path, this.PropertyType.Name));
            }

            return(DataBackingStore.GetBinaryStream2(OwnerNode.Id, OwnerNode.VersionId, PropertyType.Id));
            //return DataBackingStore.GetBinaryStream(OwnerNode.VersionId, PropertyType.Id);
        }
Пример #3
0
        /// <summary>Preloads all uncached text properties to avoid more than one database access.</summary>
        internal void PreloadTextProperties()
        {
            if (Id == 0)
            {
                return;
            }

            if (!this.IsShared)
            {
                if (this.SharedData != null)
                {
                    this.SharedData.PreloadTextProperties();
                }
                return;
            }

            var notLoadedTextPropertyTypeIds = this.TextPropertyIds.Where(p => !dynamicData.ContainsKey(p)).ToArray();
            var data = DataBackingStore.LoadTextProperties(this.VersionId, notLoadedTextPropertyTypeIds);

            foreach (var id in notLoadedTextPropertyTypeIds)
            {
                string value = null;
                data.TryGetValue(id, out value);
                dynamicData[id] = value;
            }
        }
Пример #4
0
        private object LoadProperty(PropertyType propertyType)
        {
            var propId = propertyType.Id;

            lock (_readPropertySync)
            {
                if (dynamicData.ContainsKey(propId))
                {
                    return(dynamicData[propId]);
                }
            }

            object data;

            if (propertyType.DataType == DataType.Text)
            {
                PreloadTextProperties();
                lock (_readPropertySync)
                    return((dynamicData.TryGetValue(propId, out data)) ? data : null);
            }

            data = DataBackingStore.LoadProperty(this.VersionId, propertyType);
            lock (_readPropertySync)
                dynamicData[propId] = data;
            return(data);
        }
Пример #5
0
        private object LoadProperty(PropertyType propertyType)
        {
            var propId = propertyType.Id;

            lock (_readPropertySync)
            {
                if (dynamicData.ContainsKey(propId))
                {
                    return(dynamicData[propId]);
                }
            }
            object data = DataBackingStore.LoadProperty(this.VersionId, propertyType);

            lock (_readPropertySync)
            {
                if (!dynamicData.ContainsKey(propId))
                {
                    dynamicData.Add(propId, data);
                }
            }
            return(data);
        }
Пример #6
0
        internal static bool NodeExists(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            if (!CanExistInDatabase(path))
            {
                return(false);
            }

            // Look at the cache first
            var pathKey = DataBackingStore.CreateNodeHeadPathCacheKey(path);

            if (DistributedApplication.Cache.Get(pathKey) as NodeHead != null)
            {
                return(true);
            }

            // If it wasn't in the cache, check the database
            return(DataProvider.NodeExists(path));
        }
 public void Rollback()
 {
     DataBackingStore.OnNodeDataRollback(this);
 }
 public void Commit()
 {
     DataBackingStore.RemoveFromCache(this);
 }
Пример #9
0
 public static IEnumerable <NodeHead> Get(IEnumerable <int> idArray)
 {
     return(DataBackingStore.GetNodeHeads(idArray));
 }
Пример #10
0
 public static NodeHead Get(string path)
 {
     return(DataBackingStore.GetNodeHead(path));
 }
Пример #11
0
 public static NodeHead GetByVersionId(int versionId)
 {
     return(DataBackingStore.GetNodeHeadByVersionId(versionId));
 }
Пример #12
0
 public static NodeHead Get(int nodeId)
 {
     return(DataBackingStore.GetNodeHead(nodeId));
 }
Пример #13
0
 public void Commit()
 {
     DataBackingStore.OnNodeDataCommit(this);
 }