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); }
/// <summary> /// Configures the agatha. /// </summary> /// <param name="appContainer">The app container.</param> protected virtual void ConfigureAgatha(IContainer appContainer) { var structureMapContainer = new Agatha.StructureMap.Container ( appContainer ); 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 ( KeyValuePair<Type, Type> keyValuePair in genericsToApplyInAssebmly ) { genericsToApply.Add(keyValuePair.Key, keyValuePair.Value); } } var serviceLayerConfiguration = new ServiceLayerConfiguration ( structureMapContainer ); var serviceAssemblies = assemblyLocator.LocateWebServiceAssemblies(); foreach ( var assembly in serviceAssemblies ) { var assemblyRef = assembly; Logger.Debug ( "Registering Requests, Responses, Handlers, and Dtos for Assembly: {0}", assemblyRef ); KnownTypeHelper.RegisterNonGenericRequestsAndResponses ( assembly ); serviceLayerConfiguration.AddRequestHandlerAssembly ( assembly ); KnownTypeProvider.RegisterDerivedTypesOf<AbstractDataTransferObject> ( assembly.GetTypes ().Where ( t => !t.IsGenericType ) ); KnownTypeHelper.RegisterGenerics ( genericsToApply, assembly ); } KnownTypeProvider.Register<TerminologyConcept> (); KnownTypeProvider.Register<TerminologyProperty> (); KnownTypeProvider.Register<TerminologyPropertyType> (); KnownTypeProvider.Register<TerminologyVocabulary> (); // register the agatha interceptors serviceLayerConfiguration.RegisterRequestHandlerInterceptor<SecurityInterceptor>(); serviceLayerConfiguration.RegisterRequestHandlerInterceptor<RuleViolationEventInterceptor> (); serviceLayerConfiguration.RequestProcessorImplementation = typeof ( Service.PerformanceLoggingRequestProcessor ); serviceLayerConfiguration.Initialize (); RegisterIRequestHandlerOfGetRequestDtoByKey ( appContainer ); CallKnownTypeProviders ( appContainer ); }
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)); }