Пример #1
0
        /// <summary>
        /// Configure to scan the given types.
        /// </summary>
        public static Configure With(IEnumerable <Type> typesToScan)
        {
            if (instance == null)
            {
                instance = new Configure();
            }

            TypesToScan = typesToScan.Union(GetAllowedTypes(Assembly.GetExecutingAssembly())).ToList();

            if (HttpRuntime.AppDomainAppId == null)
            {
                var baseDirectory = lastProbeDirectory ?? AppDomain.CurrentDomain.BaseDirectory;
                var hostPath      = Path.Combine(baseDirectory, "NServiceBus.Host.exe");
                if (File.Exists(hostPath))
                {
                    TypesToScan = TypesToScan.Union(GetAllowedTypes(Assembly.LoadFrom(hostPath))).ToList();
                }
            }

            //TODO: re-enable when we make message scanning lazy #1617
            //TypesToScan = TypesToScan.Union(GetMessageTypes(TypesToScan)).ToList();

            Logger.DebugFormat("Number of types to scan: {0}", TypesToScan.Count);

            EndpointHelper.StackTraceToExamine = new StackTrace();

            instance.InvokeISetDefaultSettings();

            return(instance);
        }
Пример #2
0
        /// <summary>
        /// Configures nServiceBus to scan the given types.
        /// </summary>
        /// <param name="typesToScan"></param>
        /// <returns></returns>
        public static Configure With(IEnumerable <Type> typesToScan)
        {
            if (instance == null)
            {
                instance = new Configure();
            }

            TypesToScan = typesToScan.Union(GetAllowedTypes(Assembly.GetExecutingAssembly()));

            if (HttpRuntime.AppDomainAppId == null)
            {
                var hostPath = Path.Combine(lastProbeDirectory ?? AppDomain.CurrentDomain.BaseDirectory, "NServiceBus.Host.exe");
                if (File.Exists(hostPath))
                {
                    TypesToScan = TypesToScan.Union(GetAllowedTypes(Assembly.LoadFrom(hostPath)));
                }
            }

            Logger.DebugFormat("Number of types to scan: {0}", TypesToScan.Count());

            return(instance);
        }