Example #1
0
        public void Initialize()
        {
            serviceLayerConfiguration.AsyncRequestProcessorImplementation = AsyncRequestProcessorImplementation;
            serviceLayerConfiguration.BusinessExceptionType          = BusinessExceptionType;
            serviceLayerConfiguration.RequestProcessorImplementation = RequestProcessorImplementation;
            serviceLayerConfiguration.SecurityExceptionType          = SecurityExceptionType;
            serviceLayerConfiguration.CacheManagerImplementation     = CacheManagerImplementation;
            serviceLayerConfiguration.CacheProviderImplementation    = CacheProviderImplementation;

            foreach (var assembly in requestHandlerAssemblies)
            {
                serviceLayerConfiguration.AddRequestHandlerAssembly(assembly);
            }

            foreach (var assembly in requestsAndResponseAssemblies)
            {
                serviceLayerConfiguration.AddRequestAndResponseAssembly(assembly);
            }

            serviceLayerConfiguration.Initialize();

            IoC.Container.Register(typeof(IRequestDispatcher), RequestDispatcherImplementation, Lifestyle.Transient);
            IoC.Container.Register(typeof(IRequestDispatcherFactory), RequestDispatcherFactoryImplementation, Lifestyle.Singleton);
            IoC.Container.Register(typeof(IAsyncRequestDispatcher), AsyncRequestDispatcherImplementation, Lifestyle.Transient);
            IoC.Container.Register(typeof(IAsyncRequestDispatcherFactory), AsyncRequestDispatcherFactoryImplementation, Lifestyle.Singleton);
        }
        public void Initialize()
        {
            serviceLayerConfiguration = new ServiceLayerConfiguration(IoC.Container)
            {
                AsyncRequestProcessorImplementation = AsyncRequestProcessorImplementation,
                BusinessExceptionType = BusinessExceptionType,
                RequestProcessorImplementation = RequestProcessorImplementation,
                SecurityExceptionType = SecurityExceptionType
            };

            foreach (var assembly in requestHandlerAssemblies)
                serviceLayerConfiguration.AddRequestHandlerAssembly(assembly);

            foreach (var assembly in requestsAndResponseAssemblies)
                serviceLayerConfiguration.AddRequestAndResponseAssembly(assembly);

            serviceLayerConfiguration.Initialize();

            IoC.Container.Register(typeof(IAsyncRequestDispatcher), AsyncRequestDispatcherImplementation, Lifestyle.Transient);
            IoC.Container.Register(typeof(IAsyncRequestDispatcherFactory), AsyncRequestDispatcherFactoryImplementation, Lifestyle.Singleton);
        }
 private static void RegisterAgathaFramework(IUnityContainer container)
 {
     var agathaContainer = new Agatha.Unity.Container(container); //UnityAgathaContainer(container);
     var agathaServiceLayer = new ServiceLayerConfiguration(agathaContainer);
     foreach (var assembly in AssemblyUtils.LoadMEDSEEKAssemblies(ServiceContext.HostSettings.ApplicationPath))
     {
         var types = AssemblyUtils.GetTypes(assembly);
         if (types.Any(t => typeof(Agatha.Common.Request).IsAssignableFrom(t)))
         {
             agathaServiceLayer.AddRequestAndResponseAssembly(assembly);
         }
         else if (types.Any(t => typeof(RequestHandler).IsAssignableFrom(t)))
         {
             agathaServiceLayer.AddRequestHandlerAssembly(assembly);
         }
     }
     agathaServiceLayer.BusinessExceptionType = typeof(BusinessException);
     agathaServiceLayer.RequestProcessorImplementation = typeof(TransactionalRequestProcessor);
     agathaServiceLayer.CacheManagerImplementation = typeof(RequestProcessorCacheManager);
     agathaServiceLayer.CacheProviderImplementation = typeof(RequestProcessorCacheProvider);
     agathaServiceLayer.Initialize();
     container.RegisterType(typeof(IWcfRequestProcessor), typeof(WcfRequestProcessor));
 }