예제 #1
0
        /// <summary>
        /// Updates an existing binary property value in the database and the blob storage.
        /// </summary>
        /// <param name="value">Binary data to update.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        public async Task UpdateBinaryPropertyAsync(BinaryDataValue value, SnDataContext dataContext)
        {
            var blobProvider = ProviderSelector.GetProvider(value.Size);
            await DataProvider.UpdateBinaryPropertyAsync(blobProvider, value, dataContext);

            dataContext.NeedToCleanupFiles = true;
        }
예제 #2
0
        /// <summary>
        /// Deletes a binary property value from the metadata database, making the corresponding blob storage entry orphaned.
        /// </summary>
        /// <param name="versionId">Content version id.</param>
        /// <param name="propertyTypeId">Binary property type id.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        public async Task DeleteBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext)
        {
            await DataProvider.DeleteBinaryPropertyAsync(versionId, propertyTypeId, dataContext);

            dataContext.NeedToCleanupFiles = true;
        }
예제 #3
0
 /// <summary>
 /// Deletes all binary properties of the requested versions.
 /// </summary>
 /// <param name="versionIds">VersionId set.</param>
 /// <param name="dataContext">Database accessor object.</param>
 /// <returns>A Task that represents the asynchronous operation.</returns>
 protected internal static Task DeleteBinaryPropertiesAsync(IEnumerable <int> versionIds, SnDataContext dataContext)
 {
     return(BlobStorageComponents.DataProvider.DeleteBinaryPropertiesAsync(versionIds, dataContext));
 }
예제 #4
0
 /// <summary>
 /// Deletes a binary property value from the metadata database, making the corresponding blob storage entry orphaned.
 /// </summary>
 /// <param name="versionId">Content version id.</param>
 /// <param name="propertyTypeId">Binary property type id.</param>
 /// <param name="dataContext">Database accessor object.</param>
 /// <returns>A Task that represents the asynchronous operation.</returns>
 protected internal static Task DeleteBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext)
 {
     return(BlobStorageComponents.DataProvider.DeleteBinaryPropertyAsync(versionId, propertyTypeId, dataContext));
 }
예제 #5
0
        /// <summary>
        /// Updates an existing binary property value in the database and the blob storage.
        /// </summary>
        /// <param name="value">Binary data to update.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        protected internal static Task UpdateBinaryPropertyAsync(BinaryDataValue value, SnDataContext dataContext)
        {
            var blobProvider = GetProvider(value.Size);

            return(BlobStorageComponents.DataProvider.UpdateBinaryPropertyAsync(blobProvider, value, dataContext));
        }
예제 #6
0
        /// <summary>
        /// Inserts a new binary record into the metadata database containing a new or an already exising file id,
        /// removing the previous record if the content is not new.
        /// </summary>
        /// <param name="value">Binary data to insert.</param>
        /// <param name="versionId">Content version id.</param>
        /// <param name="propertyTypeId">Binary property type id.</param>
        /// <param name="isNewNode">Whether this value belongs to a new or an existing node.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        protected internal static Task InsertBinaryPropertyAsync(BinaryDataValue value, int versionId, int propertyTypeId, bool isNewNode, SnDataContext dataContext)
        {
            var blobProvider = GetProvider(value.Size);

            if (value.FileId > 0 && value.Stream == null)
            {
                return(BlobStorageComponents.DataProvider.InsertBinaryPropertyWithFileIdAsync(value, versionId, propertyTypeId, isNewNode, dataContext));
            }
            else
            {
                return(BlobStorageComponents.DataProvider.InsertBinaryPropertyAsync(blobProvider, value, versionId, propertyTypeId, isNewNode, dataContext));
            }
        }
예제 #7
0
 public new static Task UpdateBinaryPropertyAsync(BinaryDataValue value, SnDataContext dataContext)
 {
     return(BlobStorageBase.UpdateBinaryPropertyAsync(value, dataContext));
 }
예제 #8
0
        /// <summary>
        /// Inserts a new binary record into the metadata database containing a new or an already existing file id,
        /// removing the previous record if the content is not new.
        /// </summary>
        /// <param name="value">Binary data to insert.</param>
        /// <param name="versionId">Content version id.</param>
        /// <param name="propertyTypeId">Binary property type id.</param>
        /// <param name="isNewNode">Whether this value belongs to a new or an existing node.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        public Task InsertBinaryPropertyAsync(BinaryDataValue value, int versionId, int propertyTypeId, bool isNewNode, SnDataContext dataContext)
        {
            var blobProvider = ProviderSelector.GetProvider(value.Size);

            if (value.FileId > 0 && value.Stream == null)
            {
                return(DataProvider.InsertBinaryPropertyWithFileIdAsync(value, versionId, propertyTypeId, isNewNode, dataContext));
            }
            else
            {
                return(DataProvider.InsertBinaryPropertyAsync(blobProvider, value, versionId, propertyTypeId, isNewNode, dataContext));
            }
        }
예제 #9
0
        /// <summary>
        /// Deletes all binary properties of the requested versions.
        /// </summary>
        /// <param name="versionIds">VersionId set.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        protected internal static async Task DeleteBinaryPropertiesAsync(IEnumerable <int> versionIds, SnDataContext dataContext)
        {
            await BlobStorageComponents.DataProvider.DeleteBinaryPropertiesAsync(versionIds, dataContext);

            dataContext.NeedToCleanupFiles = true;
        }
예제 #10
0
        /// <summary>
        /// Deletes a binary property value from the metadata database, making the corresponding blob storage entry orphaned.
        /// </summary>
        /// <param name="versionId">Content version id.</param>
        /// <param name="propertyTypeId">Binary property type id.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        protected internal static async Task DeleteBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext)
        {
            await BlobStorageComponents.DataProvider.DeleteBinaryPropertyAsync(versionId, propertyTypeId, dataContext);

            dataContext.NeedToCleanupFiles = true;
        }
예제 #11
0
        /// <summary>
        /// Updates an existing binary property value in the database and the blob storage.
        /// </summary>
        /// <param name="value">Binary data to update.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        protected internal static async Task UpdateBinaryPropertyAsync(BinaryDataValue value, SnDataContext dataContext)
        {
            var blobProvider = GetProvider(value.Size);
            await BlobStorageComponents.DataProvider.UpdateBinaryPropertyAsync(blobProvider, value, dataContext);

            dataContext.NeedToCleanupFiles = true;
        }
예제 #12
0
 public new static Task <BinaryCacheEntity> LoadBinaryCacheEntityAsync(int nodeVersionId, int propertyTypeId, SnDataContext dataContext)
 {
     return(BlobStorageBase.LoadBinaryCacheEntityAsync(nodeVersionId, propertyTypeId, dataContext));
 }
예제 #13
0
 public new static Task <BinaryDataValue> LoadBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext)
 {
     return(BlobStorageBase.LoadBinaryPropertyAsync(versionId, propertyTypeId, dataContext));
 }
예제 #14
0
 public new static Task DeleteBinaryPropertiesAsync(IEnumerable <int> versionIds, SnDataContext dataContext)
 {
     return(BlobStorageBase.DeleteBinaryPropertiesAsync(versionIds, dataContext));
 }
예제 #15
0
 public new static Task DeleteBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext)
 {
     return(BlobStorageBase.DeleteBinaryPropertyAsync(versionId, propertyTypeId, dataContext));
 }
예제 #16
0
        /// <summary>
        /// Deletes all binary properties of the requested versions.
        /// </summary>
        /// <param name="versionIds">VersionId set.</param>
        /// <param name="dataContext">Database accessor object.</param>
        /// <returns>A Task that represents the asynchronous operation.</returns>
        public async Task DeleteBinaryPropertiesAsync(IEnumerable <int> versionIds, SnDataContext dataContext)
        {
            await DataProvider.DeleteBinaryPropertiesAsync(versionIds, dataContext);

            dataContext.NeedToCleanupFiles = true;
        }
예제 #17
0
 /// <summary>
 /// Loads a cache item into memory that either contains the raw binary (if its size fits into the limit) or
 /// just the blob metadata pointing to the blob storage.
 /// </summary>
 /// <param name="versionId">Content version id.</param>
 /// <param name="propertyTypeId">Binary property type id.</param>
 /// <param name="dataContext">Database accessor object.</param>
 /// <returns>A Task that represents the asynchronous operation
 /// containig the loaded <see cref="BinaryCacheEntity"/> instance or null.</returns>
 public Task <BinaryCacheEntity> LoadBinaryCacheEntityAsync(int versionId, int propertyTypeId,
                                                            SnDataContext dataContext)
 {
     return(DataProvider.LoadBinaryCacheEntityAsync(versionId, propertyTypeId, dataContext));
 }
예제 #18
0
 /// <summary>
 /// Loads binary property object without the stream by the given parameters.
 /// </summary>
 /// <param name="versionId">Content version id.</param>
 /// <param name="propertyTypeId">Binary property type id.</param>
 /// <param name="dataContext">Database accessor object.</param>
 /// <returns>A Task that represents the asynchronous operation
 /// containing the loaded <see cref="BinaryDataValue"/> instance or null.</returns>
 protected static Task <BinaryDataValue> LoadBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext)
 {
     return(BlobStorageComponents.DataProvider.LoadBinaryPropertyAsync(versionId, propertyTypeId, dataContext));
 }
예제 #19
0
 /// <summary>
 /// Loads a cache item into memory that either contains the raw binary (if its size fits into the limit) or
 /// just the blob metadata pointing to the blob storage.
 /// </summary>
 /// <param name="versionId">Content version id.</param>
 /// <param name="propertyTypeId">Binary property type id.</param>
 /// <param name="dataContext">Database accessor object.</param>
 /// <returns>A Task that represents the asynchronous operation
 /// containig the loaded <see cref="BinaryCacheEntity"/> instance or null.</returns>
 protected internal static Task <BinaryCacheEntity> LoadBinaryCacheEntityAsync(int versionId, int propertyTypeId,
                                                                               SnDataContext dataContext)
 {
     return(BlobStorageComponents.DataProvider.LoadBinaryCacheEntityAsync(versionId, propertyTypeId, dataContext));
 }
예제 #20
0
 public new static Task InsertBinaryPropertyAsync(BinaryDataValue value, int versionId, int propertyTypeId, bool isNewNode, SnDataContext dataContext)
 {
     return(BlobStorageBase.InsertBinaryPropertyAsync(value, versionId, propertyTypeId, isNewNode, dataContext));
 }