/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> public static void RegisterTypes(IUnityContainer container) { //Standard configuration StandardUnityConfig.RegisterStandardFacetFactories(container); StandardUnityConfig.RegisterCoreContainerControlledTypes(container); StandardUnityConfig.RegisterCorePerTransactionTypes <PerResolveLifetimeManager>(container); // config container.RegisterInstance <IReflectorConfiguration>(NakedObjectsRunSettings.ReflectorConfig(), (new ContainerControlledLifetimeManager())); container.RegisterInstance <IEntityObjectStoreConfiguration>(NakedObjectsRunSettings.EntityObjectStoreConfig(), new ContainerControlledLifetimeManager()); // surface container.RegisterType <IOidStrategy, ExternalOid>(new PerRequestLifetimeManager()); container.RegisterType <INakedObjectsSurface, NakedObjectsSurface>(new PerRequestLifetimeManager()); //Externals container.RegisterType <IPrincipal>(new InjectionFactory(c => HttpContext.Current.User)); // Facet decorators if (NakedObjectsRunSettings.AuditConfig() != null) { container.RegisterType(typeof(IFacetDecorator), typeof(AuditManager), "AuditManager", new ContainerControlledLifetimeManager()); container.RegisterInstance(typeof(IAuditConfiguration), NakedObjectsRunSettings.AuditConfig(), new ContainerControlledLifetimeManager()); } if (NakedObjectsRunSettings.AuthorizationConfig() != null) { container.RegisterType(typeof(IFacetDecorator), typeof(AuthorizationManager), "AuthorizationManager", new ContainerControlledLifetimeManager()); container.RegisterInstance(typeof(IAuthorizationConfiguration), NakedObjectsRunSettings.AuthorizationConfig(), new ContainerControlledLifetimeManager()); } }
/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> public static void RegisterTypes(IUnityContainer container) { //Standard configuration StandardUnityConfig.RegisterStandardFacetFactories(container); StandardUnityConfig.RegisterCoreContainerControlledTypes(container); StandardUnityConfig.RegisterCorePerTransactionTypes <PerRequestLifetimeManager>(container); // config container.RegisterInstance <IReflectorConfiguration>(NakedObjectsRunSettings.ReflectorConfig(), (new ContainerControlledLifetimeManager())); container.RegisterInstance <IEntityObjectStoreConfiguration>(NakedObjectsRunSettings.EntityObjectStoreConfig(), new ContainerControlledLifetimeManager()); // surface container.RegisterType <IOidTranslator, OidTranslatorSlashSeparatedTypeAndIds>("KeyOid", new PerRequestLifetimeManager()); container.RegisterType <IOidTranslator, OidTranslatorSemiColonSeparatedList>(new PerRequestLifetimeManager()); container.RegisterType <IOidStrategy, EntityOidStrategy>(new PerRequestLifetimeManager()); container.RegisterType <IIdHelper, IdHelper>(new PerRequestLifetimeManager()); container.RegisterType <IFrameworkFacade, FrameworkFacade>("RestSurface", new PerRequestLifetimeManager(), new InjectionConstructor(typeof(IOidStrategy), new ResolvedParameter <IOidTranslator>("KeyOid"), typeof(INakedObjectsFramework))); container.RegisterType <IFrameworkFacade, FrameworkFacade>(new PerRequestLifetimeManager()); container.RegisterType <RestfulObjectsController, RestfulObjectsController>(new PerResolveLifetimeManager(), new InjectionConstructor(new ResolvedParameter <IFrameworkFacade>("RestSurface"))); //Externals container.RegisterType <IPrincipal>(new InjectionFactory(c => HttpContext.Current.User)); // Facet decorators if (NakedObjectsRunSettings.AuditConfig() != null) { container.RegisterType(typeof(IFacetDecorator), typeof(AuditManager), "AuditManager", new ContainerControlledLifetimeManager()); container.RegisterInstance(typeof(IAuditConfiguration), NakedObjectsRunSettings.AuditConfig(), new ContainerControlledLifetimeManager()); } if (NakedObjectsRunSettings.AuthorizationConfig() != null) { container.RegisterType(typeof(IFacetDecorator), typeof(AuthorizationManager), "AuthorizationManager", new ContainerControlledLifetimeManager()); container.RegisterInstance(typeof(IAuthorizationConfiguration), NakedObjectsRunSettings.AuthorizationConfig(), new ContainerControlledLifetimeManager()); } if (NakedObjectsRunSettings.ProfileConfig() != null) { container.RegisterType(typeof(IFacetDecorator), typeof(ProfileManager), "ProfileManager", new ContainerControlledLifetimeManager()); container.RegisterInstance(typeof(IProfileConfiguration), NakedObjectsRunSettings.ProfileConfig(), new ContainerControlledLifetimeManager()); } }