public static void RegisterTypes(IUnityContainer container) { var myAssemblies = AppDomain.CurrentDomain.GetAssemblies() .Where(a => a.FullName.StartsWith(ClassesToScan)) .ToArray(); container.RegisterTypes(UnityHelpers.GetTypesWithCustomAttribute <UnityIoCPerRequestLifetimeAttribute>(myAssemblies), WithMappings.FromMatchingInterface, WithName.Default, PerRequest ) .RegisterTypes(UnityHelpers.GetTypesWithCustomAttribute <UnityIoCTransientLifetimeAttribute>(myAssemblies), WithMappings.FromMatchingInterface, WithName.Default, WithLifetime.Transient ); }