Registration by Convention in Unity 3.5 Portable Class Library Preview

Jul 1, 2014 at 5:06 AM
Edited Jul 1, 2014 at 6:47 AM
I have been previously using Unity 3.0, It has RegisterTypes function which can load Classes from an assembly.
var container = new UnityContainer();
        container.RegisterTypes(AllClasses.FromAssemblies(),
            WithMappings.FromMatchingInterface,
            WithName.Default,
            WithLifetime.ContainerControlled
            );
When I upgraded to Unity 3.5 Portable Class Library Preview this function is no longer available.
How to use Registration by Convention in Unity 3.5 Portable Class Library Preview?
Jul 2, 2014 at 7:15 AM
You should use the Unity 3.5.1405-prerelease which has PCL support. Registration by convention is in its own assembly (Microsoft.Practices.Unity.RegistrationByConvention.dll) which will be available if the platform supports it. For example, it will not be available in apps targeting Windows Phone 8.1.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Marked as answer by akhaider on 7/2/2014 at 1:47 AM