本文整理汇总了C#中Kooboo.CMS.Content.Models.MediaContent.MediaContentToBlob方法的典型用法代码示例。如果您正苦于以下问题:C# MediaContent.MediaContentToBlob方法的具体用法?C# MediaContent.MediaContentToBlob怎么用?C# MediaContent.MediaContentToBlob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kooboo.CMS.Content.Models.MediaContent
的用法示例。
在下文中一共展示了MediaContent.MediaContentToBlob方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add(MediaContent content, bool overrided)
{
if (content.ContentFile != null)
{
content.FileName = content.ContentFile.FileName;
content.UserKey = content.FileName;
content.UUID = content.FileName;
var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient();
var contentBlob = blobClient.GetBlobReference(content.GetMediaBlobPath());
contentBlob = content.MediaContentToBlob(contentBlob);
contentBlob.UploadFromStream(content.ContentFile.Stream);
content.VirtualPath = contentBlob.Uri.ToString();
}
}
示例2: Update
public void Update(MediaContent @new, MediaContent old)
{
if ([email protected](old.FileName, StringComparison.OrdinalIgnoreCase))
{
MoveContent(old, @new);
}
var blobClient = CloudStorageAccountHelper.GetStorageAccount().CreateCloudBlobClient();
var contentBlob = blobClient.GetBlobReference(@new.GetMediaBlobPath());
contentBlob = @new.MediaContentToBlob(contentBlob);
contentBlob.SetMetadata();
@new.VirtualPath = contentBlob.Uri.ToString();
}