本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient类的典型用法代码示例。如果您正苦于以下问题:C# CloudBlobClient类的具体用法?C# CloudBlobClient怎么用?C# CloudBlobClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudBlobClient类属于Microsoft.WindowsAzure.Storage.Blob命名空间,在下文中一共展示了CloudBlobClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AzureBlobClient
public AzureBlobClient()
{
var storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
_blobClient = storageAccount.CreateCloudBlobClient();
}
开发者ID:jchindev,项目名称:testing1,代码行数:7,代码来源:AzureBlobClient.cs
示例2: TestInitialize
public void TestInitialize()
{
this.blobClient = GenerateCloudBlobClient();
// Create and log a new prefix for this test.
this.prefix = Guid.NewGuid().ToString("N");
}
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:7,代码来源:LeaseTests.cs
示例3: AzureImageUploader
public AzureImageUploader()
{
var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
_blobClient = storageAccount.CreateCloudBlobClient();
_container = FindOrCreateContainer(ContainerName);
_filecontainer = FindOrCreateContainer(FileContainerName);
}
开发者ID:skyfighter007,项目名称:Britespokes-Dev,代码行数:7,代码来源:AzureImageUploader.cs
示例4: UploadBlob
public Task UploadBlob(
Uri url,
string localFile,
FileEncryption fileEncryption,
CancellationToken cancellationToken,
CloudBlobClient client,
IRetryPolicy retryPolicy,
string contentType = null,
string subDirectory = "",
Func<string> getSharedAccessSignature = null,
int parallelTransferThreadCount = 10,
int numberOfConcurrentTransfers = default(int))
{
SetConnectionLimits(url, numberOfConcurrentTransfers);
return Task.Factory.StartNew(
() => UploadFileToBlob(
cancellationToken,
url,
localFile,
contentType,
subDirectory,
fileEncryption,
client,
retryPolicy,
getSharedAccessSignature,
parallelTransferThreadCount),
cancellationToken);
}
开发者ID:JeromeZhao,项目名称:azure-sdk-for-media-services,代码行数:28,代码来源:BlobUploader.cs
示例5: LocationModeWithMissingUriAsync
public async Task LocationModeWithMissingUriAsync()
{
AssertSecondaryEndpoint();
CloudBlobClient client = GenerateCloudBlobClient();
CloudBlobClient primaryOnlyClient = new CloudBlobClient(client.BaseUri, client.Credentials);
CloudBlobContainer container = primaryOnlyClient.GetContainerReference("nonexistingcontainer");
BlobRequestOptions options = new BlobRequestOptions()
{
LocationMode = LocationMode.SecondaryOnly,
RetryPolicy = new NoRetry(),
};
Exception e = await TestHelper.ExpectedExceptionAsync<Exception>(
async () => await container.FetchAttributesAsync(null, options, null),
"Request should fail when an URI is not provided for the target location");
Assert.IsInstanceOfType(e.InnerException, typeof(InvalidOperationException));
options.LocationMode = LocationMode.SecondaryThenPrimary;
e = await TestHelper.ExpectedExceptionAsync<Exception>(
async () => await container.FetchAttributesAsync(null, options, null),
"Request should fail when an URI is not provided for the target location");
Assert.IsInstanceOfType(e.InnerException, typeof(InvalidOperationException));
options.LocationMode = LocationMode.PrimaryThenSecondary;
e = await TestHelper.ExpectedExceptionAsync<Exception>(
async () => await container.FetchAttributesAsync(null, options, null),
"Request should fail when an URI is not provided for the target location");
Assert.IsInstanceOfType(e.InnerException, typeof(InvalidOperationException));
}
开发者ID:tamram,项目名称:azure-storage-net,代码行数:31,代码来源:SecondaryTests.cs
示例6: UsersForAdminCsvPublishService
public UsersForAdminCsvPublishService(CloudBlobClient blobClient,
IAdminUserService adminUserService,
IMapper mapper) : base(blobClient, new UserForAdminCsvFormatter())
{
_adminUserService = adminUserService;
_mapper = mapper;
}
开发者ID:GusLab,项目名称:video-portal,代码行数:7,代码来源:UsersForAdminCsvPublishService.cs
示例7: Run
public static void Run(string connectionString, bool disableLogging)
{
_connectionString = connectionString;
_storageAccount = CloudStorageAccount.Parse(connectionString);
_blobClient = _storageAccount.CreateCloudBlobClient();
Console.WriteLine("Creating the test blob...");
CreateTestBlob();
try
{
TimeSpan azureSDKTime = RunAzureSDKTest();
TimeSpan webJobsSDKTime = RunWebJobsSDKTest(disableLogging);
// Convert to ulong because the measurment block does not support other data type
ulong perfRatio = (ulong)((webJobsSDKTime.TotalMilliseconds / azureSDKTime.TotalMilliseconds) * 100);
Console.WriteLine("--- Results ---");
Console.WriteLine("Azure SDK: {0} ms: ", azureSDKTime.TotalMilliseconds);
Console.WriteLine("WebJobs SDK: {0} ms: ", webJobsSDKTime.TotalMilliseconds);
Console.WriteLine("Perf ratio (x100, long): {0}", perfRatio);
MeasurementBlock.Mark(
perfRatio,
(disableLogging ? BlobNoLoggingOverheadMetric : BlobLoggingOverheadMetric) + ";Ratio;Percent");
}
finally
{
Cleanup();
}
}
开发者ID:chungvinhkhang,项目名称:azure-webjobs-sdk,代码行数:32,代码来源:BlobOverheadPerfTest.cs
示例8: FunctionsController
internal FunctionsController(
CloudStorageAccount account,
CloudBlobClient blobClient,
IFunctionInstanceLookup functionInstanceLookup,
IFunctionLookup functionLookup,
IFunctionIndexReader functionIndexReader,
IHeartbeatValidityMonitor heartbeatMonitor,
IAborter aborter,
IRecentInvocationIndexReader recentInvocationsReader,
IRecentInvocationIndexByFunctionReader recentInvocationsByFunctionReader,
IRecentInvocationIndexByJobRunReader recentInvocationsByJobRunReader,
IRecentInvocationIndexByParentReader recentInvocationsByParentReader,
IFunctionStatisticsReader statisticsReader,
ILogReader reader)
{
_account = account;
_blobClient = blobClient;
_functionInstanceLookup = functionInstanceLookup;
_functionLookup = functionLookup;
_functionIndexReader = functionIndexReader;
_heartbeatMonitor = heartbeatMonitor;
_aborter = aborter;
_recentInvocationsReader = recentInvocationsReader;
_recentInvocationsByFunctionReader = recentInvocationsByFunctionReader;
_recentInvocationsByJobRunReader = recentInvocationsByJobRunReader;
_recentInvocationsByParentReader = recentInvocationsByParentReader;
_statisticsReader = statisticsReader;
_reader = reader;
}
开发者ID:chungvinhkhang,项目名称:azure-webjobs-sdk,代码行数:29,代码来源:FunctionsController.cs
示例9: BlobStorageManager
public BlobStorageManager(string blobConnectionEndPointString)
{
this.blobConnectionEndPointString = blobConnectionEndPointString;
CloudStorageAccount VP2ClientBlobStorageAccount = CloudStorageAccount.Parse(blobConnectionEndPointString);
VP2CloudBlobClient = VP2ClientBlobStorageAccount.CreateCloudBlobClient();
VP2CloudTableClient = VP2ClientBlobStorageAccount.CreateCloudTableClient();
}
开发者ID:RmsiskaVS,项目名称:ClientLauncherBinariesZipper,代码行数:7,代码来源:BlobStorageManager.cs
示例10: Blob
/// <summary>
/// Constructor
/// </summary>
/// <param name="blobClient">use BlobConn to get blobClient</param>
/// <param name="clientContainerName">This should be the ID of the User</param>
/// <returns></returns>
public Blob(CloudBlobClient blobClient, string clientContainerName)
{
//Get a reference to a container and create container for first time use user
container = blobClient.GetContainerReference(clientContainerName);
container.CreateIfNotExists();
indicator = "OK";
}
开发者ID:hangmiao,项目名称:DBLike,代码行数:13,代码来源:Blob.cs
示例11: BlobStorage
public BlobStorage()
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ReadConfig.CommonCloudCoreApplicationSettings.Storage.StorageConnectionString);
blobClient = storageAccount.CreateCloudBlobClient();
blobClient.DefaultRequestOptions.ServerTimeout = TimeSpan.FromMinutes(10);
// blobClient.ServerTimeout = TimeSpan.FromMinutes(10);
}
开发者ID:Exclr8,项目名称:CloudCore,代码行数:7,代码来源:BlobStorage.cs
示例12: BlobFileProvider
public BlobFileProvider(IEnumerable<string> locations)
: base()
{
_storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
_blobClient = _storageAccount.CreateCloudBlobClient();
_container = _blobClient.GetContainerReference("data");
_container.CreateIfNotExists();
_strings = new List<string>();
foreach(string location in locations) {
foreach (IListBlobItem item in _container.ListBlobs(location,true))
{
if (item.GetType() == typeof(CloudBlockBlob))
{
CloudBlockBlob blob = (CloudBlockBlob)item;
string text;
using (var memoryStream = new MemoryStream())
{
blob.DownloadToStream(memoryStream);
text = Encoding.UTF8.GetString(memoryStream.ToArray());
if (text[0] == _byteOrderMarkUtf8[0])
{
text= text.Remove(0,_byteOrderMarkUtf8.Length);
}
_strings.Add(text);
}
}
}
}
}
开发者ID:crb02005,项目名称:RandomTables,代码行数:30,代码来源:BlobProvider.cs
示例13: UploadBlob
public Task UploadBlob(
Uri url,
string localFile,
FileEncryption fileEncryption,
CancellationToken cancellationToken,
CloudBlobClient client,
IRetryPolicy retryPolicy,
string contentType = null,
string subDirectory = "",
Func<string> getSharedAccessSignature = null)
{
SetConnectionLimits(url);
return Task.Factory.StartNew(
() => UploadFileToBlob(
cancellationToken,
url,
localFile,
contentType,
subDirectory,
fileEncryption,
client,
retryPolicy,
getSharedAccessSignature),
cancellationToken);
}
开发者ID:Ginichen,项目名称:azure-sdk-for-media-services,代码行数:25,代码来源:BlobUploader.cs
示例14: AzureDirectory
/// <summary>
/// Create an AzureDirectory
/// </summary>
/// <param name="storageAccount">storage account to use</param>
/// <param name="containerName">name of container (folder in blob storage)</param>
/// <param name="cacheDirectory">local Directory object to use for local cache</param>
/// <param name="rootFolder">path of the root folder inside the container</param>
public AzureDirectory(
CloudStorageAccount storageAccount,
string containerName = null,
Lucene.Net.Store.Directory cacheDirectory = null,
bool compressBlobs = false,
string rootFolder = null)
{
if (storageAccount == null)
throw new ArgumentNullException("storageAccount");
if (string.IsNullOrEmpty(containerName))
_containerName = "lucene";
else
_containerName = containerName.ToLower();
if (string.IsNullOrEmpty(rootFolder))
_rootFolder = string.Empty;
else
{
rootFolder = rootFolder.Trim('/');
_rootFolder = rootFolder + "/";
}
_blobClient = storageAccount.CreateCloudBlobClient();
_initCacheDirectory(cacheDirectory);
this.CompressBlobs = compressBlobs;
}
开发者ID:jclementson,项目名称:Examine,代码行数:34,代码来源:AzureDirectory.cs
示例15: UploadFile
public virtual Uri UploadFile(
string storageName,
Uri blobEndpointUri,
string storageKey,
string filePath,
BlobRequestOptions blobRequestOptions)
{
StorageCredentials credentials = new StorageCredentials(storageName, storageKey);
CloudBlobClient client = new CloudBlobClient(blobEndpointUri, credentials);
string blobName = string.Format(
CultureInfo.InvariantCulture,
"{0}_{1}",
DateTime.UtcNow.ToString("yyyyMMdd_HHmmss", CultureInfo.InvariantCulture),
Path.GetFileName(filePath));
CloudBlobContainer container = client.GetContainerReference(ContainerName);
container.CreateIfNotExists();
CloudBlockBlob blob = container.GetBlockBlobReference(blobName);
BlobRequestOptions uploadRequestOption = blobRequestOptions ?? new BlobRequestOptions();
if (!uploadRequestOption.ServerTimeout.HasValue)
{
uploadRequestOption.ServerTimeout = TimeSpan.FromMinutes(300);
}
using (FileStream readStream = File.OpenRead(filePath))
{
blob.UploadFromStream(readStream, AccessCondition.GenerateEmptyCondition(), uploadRequestOption);
}
return new Uri(string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}", client.BaseUri, ContainerName, client.DefaultDelimiter, blobName));
}
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:33,代码来源:CloudBlobUtility.cs
示例16: HomeController
public HomeController()
{
storageAccount = CloudStorageAccount.Parse(
ConfigurationManager.AppSettings["StorageConnectionString"]);
tableClient = storageAccount.CreateCloudTableClient();
table = tableClient.GetTableReference("fouramigos");
table.CreateIfNotExists();
blobClient = storageAccount.CreateCloudBlobClient();
container = blobClient.GetContainerReference("fouramigos");
container.CreateIfNotExists();
BlobContainerPermissions permissions = container.GetPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
container.SetPermissions(permissions);
//lägga till nya
//var tablemodels = new TableModel("Brutus", "Uggla") { Location = "T4", Description="Uggla i träd", Type="Foto" };
//var tablemodels1 = new TableModel("brutus", "Örn") { Location = "T4", Description="Örn som flyger", Type = "Foto" };
//var opreation = TableOperation.Insert(tablemodels);
//var operation2 = TableOperation.Insert(tablemodels1);
//table.Execute(opreation);
//table.Execute(operation2);
}
开发者ID:Quintoh,项目名称:Konstprojektet,代码行数:32,代码来源:HomeController.cs
示例17: BlobStorage
public BlobStorage(string connectionString)
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
this._blobClient = storageAccount.CreateCloudBlobClient();
}
开发者ID:markglibres,项目名称:cad.azure,代码行数:7,代码来源:BlobStorage.cs
示例18: AzureStore
/// <summary>
/// Constructor for a store backed by Azure
/// </summary>
/// <param name="blobStorage">The storage account that backs this store</param>
/// <param name="enableSnapshots">Whether any save on this store should create snapshots</param>
/// <param name="deletedKey">The metadata key to check if a store item is soft deleted</param>
/// <param name="containerPrefix">Use this to namespace your containers if required</param>
public AzureStore(CloudBlobClient blobStorage, bool enableSnapshots, string deletedKey = null, string containerPrefix = null)
{
_blobStorage = blobStorage;
_enableSnapshots = enableSnapshots;
_deletedKey = deletedKey ?? DefaultDeletedKey;
_containerPrefix = containerPrefix;
}
开发者ID:KalixHealth,项目名称:Kalix.Leo,代码行数:14,代码来源:AzureStore.cs
示例19: StorageHelper
public StorageHelper()
{
_adminuser = "administrator";
_standarduser = "standard-student";
try
{
var connstring = ConfigurationManager.AppSettings["AzureStorage"];
var acct = CloudStorageAccount.Parse(connstring);
client = acct.CreateCloudBlobClient();
var dir = client.GetContainerReference("studentconnect");
var adminpwd = dir.GetBlobReferenceFromServer("_adminpassword");
// If you get a 403 - Forbidden warning here, its because you dont have access to SD's Azure Storage account.
// Get your own FREE here. http://www.windowsazure.com/en-us/pricing/free-trial/
var adminpwdText = adminpwd.DownloadText();
var schoolsRef = dir.GetBlobReferenceFromServer("_schools");
var schoolsText = schoolsRef.DownloadText();
_adminpassword = adminpwdText;
_schools = this.ParseSchoolText(schoolsText);
}
finally
{
}
}
开发者ID:kishorejoshi,项目名称:StudentConnectAdmin,代码行数:26,代码来源:StorageHelper.cs
示例20: UploadPdfToBlob
/// <summary>
/// Upload the generated receipt Pdf to Blob storage.
/// </summary>
/// <param name="file">Byte array containig the Pdf file contents to be uploaded.</param>
/// <param name="fileName">The desired filename of the uploaded file.</param>
/// <returns></returns>
public string UploadPdfToBlob(byte[] file, string fileName)
{
// Create the blob client.
blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve a reference to a container.
blobContainer = blobClient.GetContainerReference(receiptBlobName);
// Create the container if it doesn't already exist.
blobContainer.CreateIfNotExists(BlobContainerPublicAccessType.Blob);
string fileUri = string.Empty;
CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(fileName);
using (var stream = new MemoryStream(file))
{
// Upload the in-memory Pdf file to blob storage.
blockBlob.UploadFromStream(stream);
}
fileUri = blockBlob.Uri.ToString();
return fileUri;
}
开发者ID:kbxkb,项目名称:ContosoSportsLeague,代码行数:31,代码来源:AzureStorageMethods.cs
注:本文中的Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论