C# Class GlobalDemo.DAL.Azure.StorageRepository

显示文件 Open project: kaevans/globalscaledemo Class Usage Examples

Public Methods

Method Description
GetBlob ( string containerName, string fileName ) : Task
GetBlobContainerSASToken ( ) : string

Gets the blob container's SAS token without any parameters. Defaults are Write permissions for 2 minutes

GetBlobContainerSASToken ( string containerName, SharedAccessBlobPermissions permissions, int minutes ) : string

Gets a blob container's SAS token

GetBlobURI ( string fileName, string containerName ) : Uri

Get a block blob's URI

GetLatestFromTableStorageAsync ( ) : Task>

This is a full table scan. Yuck.

GetPhotoFromTableAsync ( string tableName, string partitionKey, string rowKey ) : Task

This is the most efficient way to retrieve, using both the partition key and row key

GetPhotosFromTableAsync ( string tableName, string partitionKey ) : Task>

This is a partition scan. Less optimal, but not as bad as a full table scan.

MonitorCopy ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer destContainer, string fileName, TextWriter log ) : Task

Monitors a blob copy operation

ReplicateBlobAsync ( string targetConnectionString, string sourceContainerName, string targetContainerName, string blobName, TextWriter log ) : Task

Replicates a blob from the current storage account to a target storage account

SaveToTableStorageAsync ( string tableName, PhotoModel model ) : Task

Saves an entity to Azure table storage

SendBroadcastQueueMessageAsync ( string data ) : Task

Sends a queue message

SendQueueMessageAsync ( string data ) : Task

Sends a queue message

StorageRepository ( Microsoft.WindowsAzure.Storage.CloudStorageAccount account ) : GlobalDemo.DAL.Models
StorageRepository ( string connectionString ) : GlobalDemo.DAL.Models
UploadBlobAsync ( MemoryStream stream, string containerName, string fileName ) : Task

Method Details

GetBlob() public method

public GetBlob ( string containerName, string fileName ) : Task
containerName string
fileName string
return Task

GetBlobContainerSASToken() public method

Gets the blob container's SAS token without any parameters. Defaults are Write permissions for 2 minutes
public GetBlobContainerSASToken ( ) : string
return string

GetBlobContainerSASToken() public method

Gets a blob container's SAS token
public GetBlobContainerSASToken ( string containerName, SharedAccessBlobPermissions permissions, int minutes ) : string
containerName string The container name
permissions SharedAccessBlobPermissions The permissions
minutes int Number of minutes the permissions are effective
return string

GetBlobURI() public method

Get a block blob's URI
public GetBlobURI ( string fileName, string containerName ) : Uri
fileName string The file name in storage
containerName string The container name
return System.Uri

GetLatestFromTableStorageAsync() public method

This is a full table scan. Yuck.
public GetLatestFromTableStorageAsync ( ) : Task>
return Task>

GetPhotoFromTableAsync() public method

This is the most efficient way to retrieve, using both the partition key and row key
public GetPhotoFromTableAsync ( string tableName, string partitionKey, string rowKey ) : Task
tableName string
partitionKey string
rowKey string
return Task

GetPhotosFromTableAsync() public method

This is a partition scan. Less optimal, but not as bad as a full table scan.
public GetPhotosFromTableAsync ( string tableName, string partitionKey ) : Task>
tableName string
partitionKey string
return Task>

MonitorCopy() public method

Monitors a blob copy operation
public MonitorCopy ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer destContainer, string fileName, TextWriter log ) : Task
destContainer Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer The destination container to monitor
fileName string
log System.IO.TextWriter The log to write output
return Task

ReplicateBlobAsync() public method

Replicates a blob from the current storage account to a target storage account
public ReplicateBlobAsync ( string targetConnectionString, string sourceContainerName, string targetContainerName, string blobName, TextWriter log ) : Task
targetConnectionString string Connection string of the target storage account
sourceContainerName string The source container
targetContainerName string The target container
blobName string The blob to replicate
log System.IO.TextWriter TextWriter used for logging
return Task

SaveToTableStorageAsync() public method

Saves an entity to Azure table storage
public SaveToTableStorageAsync ( string tableName, PhotoModel model ) : Task
tableName string The name of the table to save to
model GlobalDemo.DAL.Models.PhotoModel The PhotoModel object to be saved
return Task

SendBroadcastQueueMessageAsync() public method

Sends a queue message
public SendBroadcastQueueMessageAsync ( string data ) : Task
data string The message to send
return Task

SendQueueMessageAsync() public method

Sends a queue message
public SendQueueMessageAsync ( string data ) : Task
data string The message to send
return Task

StorageRepository() public method

public StorageRepository ( Microsoft.WindowsAzure.Storage.CloudStorageAccount account ) : GlobalDemo.DAL.Models
account Microsoft.WindowsAzure.Storage.CloudStorageAccount
return GlobalDemo.DAL.Models

StorageRepository() public method

public StorageRepository ( string connectionString ) : GlobalDemo.DAL.Models
connectionString string
return GlobalDemo.DAL.Models

UploadBlobAsync() public method

public UploadBlobAsync ( MemoryStream stream, string containerName, string fileName ) : Task
stream System.IO.MemoryStream
containerName string
fileName string
return Task