Skip to content

Latest commit

 

History

History
75 lines (71 loc) · 2.24 KB

README.md

File metadata and controls

75 lines (71 loc) · 2.24 KB

Azure-Storage-Binding

A WCF binding enables communication via Azure Storage

Usage

In C#

Server Side

 serviceHost.AddServiceEndpoint(
      typeof(IServiceContract),
      new TableTransportBinding()
      {
          ConnectionString = "azure-storage-connectionstring",
          TargetPartitionKey = "all"
      },
      "endpoint-address");

Client Side

var client =
      new ServiceClient(new TableTransportBinding() 
      { 
          ConnectionString = "azure-storage-connectionstring", 
          TargetPartitionKey = "client-id" 
      },
      "endpoint-address");

In XML

Server Side

 <system.serviceModel>
    <extensions>
      <bindingExtensions>
        <add name="azureTableTransportBinding"
             type="AzureStorageBinding.Table.Binding.TableTransportBindingCollectionElement, AzureStorageBinding" />
      </bindingExtensions>
    </extensions>
    <bindings>
      <azureTableTransportBinding>
        <binding name="EchoService"
                 connectionString="UseDevelopmentStorage=true" />
      </azureTableTransportBinding>
    </bindings>
    <services>
      <service name="AzureStorageBinding.TestingService.EchoService">
        <endpoint address="az.table://EchoTesting" binding="azureTableTransportBinding"
                  bindingConfiguration="EchoService" contract="AzureStorageBinding.TestingContract.IEcho" />
      </service>
    </services>
  </system.serviceModel>

Client Side

 <system.serviceModel>
   <extensions>
     <bindingExtensions>
       <add name="azureTableTransportBinding"
            type="AzureStorageBinding.Table.Binding.TableTransportBindingCollectionElement, AzureStorageBinding" />
     </bindingExtensions>
   </extensions>
   <bindings>
     <azureTableTransportBinding>
       <binding name="EchoClient"
                connectionString="UseDevelopmentStorage=true"
                targetPartitionKey="client0" />
     </azureTableTransportBinding>
   </bindings>
   <client>
     <endpoint address="az.table:EchoTesting" binding="azureTableTransportBinding" bindingConfiguration="EchoClient"
               contract="AzureStorageBinding.TestingContract.IEchoClient" name="EchoClient" />
   </client>
 </system.serviceModel>