Skip to content

Commit 0d0725d

Browse files
author
Pedro Wood
committed
2 parents db1207a + 48ddb6b commit 0d0725d

File tree

6 files changed

+336
-82
lines changed

6 files changed

+336
-82
lines changed

BlobStorage/Advanced.cs

Lines changed: 294 additions & 63 deletions
Large diffs are not rendered by default.

BlobStorage/BlobStorage.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
</Reference>
6464
<Reference Include="System" />
6565
<Reference Include="System.Core" />
66+
<Reference Include="System.ServiceModel" />
6667
<Reference Include="System.Spatial, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6768
<HintPath>..\packages\System.Spatial.5.7.0\lib\net40\System.Spatial.dll</HintPath>
6869
<Private>True</Private>
@@ -80,6 +81,7 @@
8081
<Compile Include="GettingStarted.cs" />
8182
<Compile Include="Program.cs" />
8283
<Compile Include="Properties\AssemblyInfo.cs" />
84+
<Compile Include="WCFBufferManagerAdapter.cs" />
8385
</ItemGroup>
8486
<ItemGroup>
8587
<None Include="App.config">

BlobStorage/GettingStarted.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,7 @@ private static Uri GetContainerUri(string containerName)
303303
// Retrieve storage account information from connection string
304304
CloudStorageAccount storageAccount = Common.CreateStorageAccountFromConnectionString();
305305

306-
Uri containerUri;
307-
308-
if (storageAccount == CloudStorageAccount.DevelopmentStorageAccount)
309-
{
310-
containerUri = new Uri(storageAccount.BlobStorageUri.PrimaryUri.OriginalString + "/" + containerName);
311-
}
312-
else
313-
{
314-
containerUri = new Uri(storageAccount.BlobStorageUri.PrimaryUri.OriginalString + containerName);
315-
}
316-
317-
return containerUri;
306+
return storageAccount.CreateCloudBlobClient().GetContainerReference(containerName).Uri;
318307
}
319308

320309
/// <summary>

BlobStorage/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ static void Main(string[] args)
6666
Console.WriteLine("Azure Blob Storage - Getting Started Samples\n");
6767
GettingStarted.CallBlobGettingStartedSamples();
6868

69-
// Uncomment the following lines to run the advanced samples.
70-
// Console.WriteLine("Azure Blob Storage - Advanced Samples\n ");
69+
Console.WriteLine("Azure Blob Storage - Advanced Samples\n ");
7170
Advanced.CallBlobAdvancedSamples().Wait();
7271

7372
Console.WriteLine();
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.ServiceModel.Channels;
2+
using Microsoft.WindowsAzure.Storage;
3+
4+
namespace BlobStorage
5+
{
6+
public class WCFBufferManagerAdapter : IBufferManager
7+
{
8+
private int defaultBufferSize = 0;
9+
10+
public WCFBufferManagerAdapter(BufferManager manager, int defaultBufferSize)
11+
{
12+
this.Manager = manager;
13+
this.defaultBufferSize = defaultBufferSize;
14+
}
15+
16+
public BufferManager Manager { get; internal set; }
17+
18+
public void ReturnBuffer(byte[] buffer)
19+
{
20+
this.Manager.ReturnBuffer(buffer);
21+
}
22+
23+
public byte[] TakeBuffer(int bufferSize)
24+
{
25+
return this.Manager.TakeBuffer(bufferSize);
26+
}
27+
28+
public int GetDefaultBufferSize()
29+
{
30+
return this.defaultBufferSize;
31+
}
32+
}
33+
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Demonstrates how to use the Blob Storage service.
1010
Blob storage stores unstructured data such as text, binary data, documents or media files.
1111
Blobs can be accessed from anywhere in the world via HTTP or HTTPS.
1212

13-
Note: This sample uses the .NET 4.5 asynchronous programming model to demonstrate how to call the Storage Service using the
14-
storage client libraries asynchronous API's. When used in real applications this approach enables you to improve the
15-
responsiveness of your application. Calls to the storage service are prefixed by the await keyword.
16-
If you don't have a Microsoft Azure subscription you can
17-
get a FREE trial account [here](http://go.microsoft.com/fwlink/?LinkId=330212)
13+
Note: This sample uses the .NET 4.5 asynchronous programming model to demonstrate how to call Azure Storage using asynchronous API calls. When used in real applications, this approach enables you to improve the
14+
responsiveness of your application. Calls to Azure Storage are prefixed by the `await` keyword. For more information about asynchronous programming using the Async/Await pattern, see [Asynchronous Programming with Async and Await (C# and Visual Basic)](https://msdn.microsoft.com/library/hh191443.aspx).
15+
16+
If you don't already have a Microsoft Azure subscription, you can
17+
get a FREE trial account [here](http://go.microsoft.com/fwlink/?LinkId=330212).
1818

1919
## Running this sample
2020

0 commit comments

Comments
 (0)