/// <summary> /// Creates the configuration object /// </summary> internal Configure BuildConfiguration() { if (scannedTypes == null) { var directoryToScan = AppDomain.CurrentDomain.BaseDirectory; if (HttpRuntime.AppDomainAppId != null) { directoryToScan = HttpRuntime.BinDirectory; } ScanAssembliesInDirectory(directoryToScan); } scannedTypes = scannedTypes.Union(Configure.GetAllowedTypes(Assembly.GetExecutingAssembly())).ToList(); if (HttpRuntime.AppDomainAppId == null) { var baseDirectory = directory ?? AppDomain.CurrentDomain.BaseDirectory; var hostPath = Path.Combine(baseDirectory, "NServiceBus.Host.exe"); if (File.Exists(hostPath)) { scannedTypes = scannedTypes.Union(Configure.GetAllowedTypes(Assembly.LoadFrom(hostPath))).ToList(); } } Settings.SetDefault("TypesToScan", scannedTypes); Configure.ActivateAndInvoke <INeedInitialization>(scannedTypes, t => t.Customize(this)); UseTransportExtensions.SetupTransport(this); var container = customBuilder ?? new AutofacObjectBuilder(); Settings.SetDefault <IConfigurationSource>(configurationSourceToUse); var endpointHelper = new EndpointHelper(new StackTrace()); if (endpointVersion == null) { endpointVersion = endpointHelper.GetEndpointVersion(); } if (endpointName == null) { endpointName = endpointHelper.GetDefaultEndpointName(); } Settings.SetDefault("EndpointName", endpointName); Settings.SetDefault("EndpointVersion", endpointVersion); if (publicReturnAddress != null) { Settings.SetDefault("PublicReturnAddress", publicReturnAddress); } container.RegisterSingleton(typeof(Conventions), conventionsBuilder.Conventions); Settings.SetDefault <Conventions>(conventionsBuilder.Conventions); return(new Configure(Settings, container, registrations, Pipeline)); }
/// <summary> /// Creates the configuration object. /// </summary> internal InitializableEndpoint Build() { if (scannedTypes == null) { var directoryToScan = AppDomain.CurrentDomain.BaseDirectory; if (HttpRuntime.AppDomainAppId != null) { directoryToScan = HttpRuntime.BinDirectory; } scannedTypes = GetAllowedTypes(directoryToScan); } else { scannedTypes = scannedTypes.Union(GetAllowedCoreTypes()).ToList(); } Settings.SetDefault("TypesToScan", scannedTypes); ActivateAndInvoke <INeedInitialization>(scannedTypes, t => t.Customize(this)); UseTransportExtensions.EnsureTransportConfigured(this); var container = customBuilder ?? new AutofacObjectBuilder(); var conventions = conventionsBuilder.Conventions; Settings.SetDefault <Conventions>(conventions); var messageMetadataRegistry = new MessageMetadataRegistry(conventions); messageMetadataRegistry.RegisterMessageTypesFoundIn(Settings.GetAvailableTypes()); Settings.SetDefault <MessageMetadataRegistry>(messageMetadataRegistry); return(new InitializableEndpoint(Settings, container, registrations, Pipeline, pipelineCollection)); }