protected virtual void RegisterTypes(IUnityContainer container)
        {
            //Standard configuration
            StandardUnityConfig.RegisterStandardFacetFactories(container);
            StandardUnityConfig.RegisterCoreContainerControlledTypes(container);
            StandardUnityConfig.RegisterCorePerTransactionTypes <PerResolveLifetimeManager>(container);

            container.RegisterType <IPrincipal>(new InjectionFactory(c => TestPrincipal));
            var config = new EntityObjectStoreConfiguration();

            //config.UsingEdmxContext("Model").AssociateTypes(AdventureWorksTypes);
            //config.SpecifyTypesNotAssociatedWithAnyContext(() => new[] { typeof(AWDomainObject) });

            container.RegisterInstance <IEntityObjectStoreConfiguration>(config, (new ContainerControlledLifetimeManager()));

            // TODO still done for backward compatibility -
            var reflectorConfig = new ReflectorConfiguration(
                Types ?? new Type[] {},
                MenuServices.Select(s => s.GetType()).ToArray(),
                ContributedActions.Select(s => s.GetType()).ToArray(),
                SystemServices.Select(s => s.GetType()).ToArray(),
                Namespaces ?? new string[] { });

            container.RegisterInstance <IReflectorConfiguration>(reflectorConfig, (new ContainerControlledLifetimeManager()));
            container.RegisterType <ISession>(new PerResolveLifetimeManager(), new InjectionFactory(c => TestSession));
        }
예제 #2
0
 private IReflectorConfiguration MyReflectorConfig()
 {
     return(new ReflectorConfiguration(
                this.Types ?? new Type[] { },
                MenuServices.Select(s => s.GetType()).ToArray(),
                ContributedActions.Select(s => s.GetType()).ToArray(),
                SystemServices.Select(s => s.GetType()).ToArray(),
                Types.Select(t => t.Namespace).Distinct().ToArray(),
                LocalMainMenus.MainMenus));
 }