Exemple #1
0
        private void ConfigureAgatha()
        {
            var agathaContainer = new Container(Container);

            IoC.Container = agathaContainer;
            Container.RegisterInstance <IContainer> (agathaContainer);
            var clientConfiguration = new ClientConfiguration(agathaContainer)
            {
                AsyncRequestDispatcherImplementation = typeof(AsyncRequestDispatcher)
            };

            KnownTypeProvider.Register(typeof(LookupValueDto));

            KnownTypeHelper.RegisterNonGenericRequestsAndResponses(typeof(InfrastructureModule).Assembly);

            clientConfiguration.AddRequestAndResponseAssembly(typeof(GetLookupValuesRequest).Assembly);

            var genericsToApply = KnownTypeHelper.GetGenerics(typeof(Const).Assembly);

            KnownTypeHelper.RegisterGenerics(genericsToApply, typeof(InfrastructureModule).Assembly);

            KnownTypeHelper.RegisterKnownTypesFromIKnownTypeProviders(typeof(IMetadataItemDto).Assembly);      // metadata

            clientConfiguration.RequestProcessorImplementation = typeof(CustomAsyncRequestProcessorProxy);

            clientConfiguration.Initialize();
        }
        protected ClientComponentResolving()
        {
            IoC.Container = null;
            KnownTypeProvider.ClearAllKnownTypes();
            var configuration = new ClientConfiguration(Assembly.GetExecutingAssembly(), Activator.CreateInstance <TContainer>());

            configuration.AddRequestAndResponseAssembly(typeof(RequestB).Assembly);
            configuration.Initialize();
        }
Exemple #3
0
        /// <summary>
        /// Configures agatha.
        /// </summary>
        /// <param name="appContainer">The app container.</param>
        protected virtual void ConfigureAgatha(IContainer appContainer)
        {
            var structureMapContainer = new Agatha.StructureMap.Container(appContainer);

            Agatha.Common.InversionOfControl.IoC.Container = structureMapContainer;

            var assemblyLocator          = appContainer.GetInstance <IAssemblyLocator> ();
            var infrastructureAssemblies = assemblyLocator.LocateInfrastructureAssemblies();

            var genericsToApply = new Dictionary <Type, Type> ();

            foreach (var infrastructureAssembly in infrastructureAssemblies)
            {
                var genericsToApplyInAssebmly = KnownTypeHelper.GetGenerics(infrastructureAssembly);

                foreach (var keyValuePair in genericsToApplyInAssebmly)
                {
                    genericsToApply.Add(keyValuePair.Key, keyValuePair.Value);
                }
            }

            var serviceAssemblies = assemblyLocator.LocateWebServiceAssemblies();

            foreach (var assembly in serviceAssemblies)
            {
                KnownTypeHelper.RegisterNonGenericRequestsAndResponses(assembly);

                KnownTypeProvider.RegisterDerivedTypesOf <AbstractDataTransferObject> (assembly.GetTypes().Where(t => !t.IsGenericType));

                KnownTypeHelper.RegisterGenerics(genericsToApply, assembly);
            }

            var clientConfiguration = new ClientConfiguration(structureMapContainer)
            {
                AsyncRequestDispatcherImplementation = typeof(AsyncRequestDispatcher)
            };

            clientConfiguration.AddRequestAndResponseAssembly(typeof(GetLookupValuesRequest).Assembly);

            clientConfiguration.RequestProcessorImplementation = typeof(CustomSyncRequestProcessorProxy);

            clientConfiguration.Initialize();
        }