Monday, September 28, 2015

Microsoft Unity - 'Microsoft.Practices.Unity.InjectedMembers' is obsolete: 'Use the IUnityContainer.RegisterType method instead of this interface'

While preparing a release I was cleaning up some build warnings that sneaked into the code.

One of the warnings I got was the following regarding Unity, Microsoft’s IoC container:

Warning              11           'Microsoft.Practices.Unity.InjectedMembers' is obsolete: 'Use the IUnityContainer.RegisterType method instead of this interface'                C:\Projects\Services\ServicesConfiguration.cs           136         38                Services

The warning was coming from the following code:

Using this code I’m configuring the constructor parameters when a ServiceAgentConfiguration class is resolved from the IoC container. I was doing this through the InjectedMembers object from Unity. However this class is obsolete, so I had to update my code to the following:

No comments: