Sunday, October 23, 2011

Unity Windows Azure Settings Injector

This is my first combined CodePlex / NuGet package contribution. This small piece of code is meant to help those of you who are using Unity as Policy Injection / DI framework and are considering moving to the cloud.

This project includes auto resolver for following Windows Azure Configuration Settings:

  • LocalStorage
  • Setting (both string setting and Azure Storage Connection string)

The source code is located at CodePlex: http://uasi.codeplex.com while the single line installation is located at NuGet:

PM> Install-Package UASI

The NuGet package will automatically add references to Unity assemblies (if not already added), to UASI assembly, and will make necessary configuration changes to your web.config / app.config file. It will also add (commented out) the following simple usage scenario for your project:

<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<
sectionExtension 
type="Unity.AzureSetting.Injector.SectionExtensionInitiator, UASI"
/>
     <!--
Bellow is sample usage of package –
>
     <
container
>      
<
register type="IStorageHelper" mapTo="StorageHelper"
>
<
lifetime type="singleton"
/>
         <
constructor
>
           <
param name="connectionString"
>
             <
azureSetting
              key="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"
              type="ConnectionString"
/>
           </
param
>
         </
constructor
>
         <
property name="RootFolderName"
>
           <
azureSetting key="LocalStore" type="LocalStorage"
/>
         </
property
>
       </
register
>
     </
container
>
</
unity>

Hope that it will work smoothly with your projects!


What to expect:


In the project roadmap are implementations for IPEndPoint resolver (for both Internal / External EndPoints) and some real sample usage showcase.


Stay tuned for updates.

No comments: