I have the following type being registered in Unity:
container.RegisterType, AzureTable>();
The
Here is an MSDN page describing what you require, Injecting Values. Take a look at using the InjectionConstructor
class in your register type line. You will end up with a line like this:
container.RegisterType, AzureTable>(new InjectionConstructor(typeof(CloudStorageAccount)));
The constructor parameters to InjectionConstructor
are the values to be passed to your AzureTable
. Any typeof
parameters leave unity to resolve the value to use. Otherwise you can just pass your implementation:
CloudStorageAccount account = new CloudStorageAccount();
container.RegisterType, AzureTable>(new InjectionConstructor(account));
Or a named parameter:
container.RegisterType("MyAccount");
container.RegisterType, AzureTable>(new InjectionConstructor(new ResolvedParameter("MyAccount")));