当前位置: 首页>>代码示例>>C#>>正文


C# BusConfiguration.AssembliesToScan方法代码示例

本文整理汇总了C#中BusConfiguration.AssembliesToScan方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.AssembliesToScan方法的具体用法?C# BusConfiguration.AssembliesToScan怎么用?C# BusConfiguration.AssembliesToScan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BusConfiguration的用法示例。


在下文中一共展示了BusConfiguration.AssembliesToScan方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScanningListOfAssemblies

        void ScanningListOfAssemblies(BusConfiguration busConfiguration, IEnumerable<Assembly> myListOfAssemblies, Assembly assembly2, Assembly assembly1)
        {
            #region ScanningListOfAssemblies

            busConfiguration.AssembliesToScan(myListOfAssemblies);
            // or
            busConfiguration.AssembliesToScan(assembly1, assembly2);

            #endregion
        }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:10,代码来源:ScanningPublicApi.cs

示例2: ScanningPublicApi

        public ScanningPublicApi()
        {
            IEnumerable<Assembly> myListOfAssemblies = null;

            Assembly assembly2 = null;
            Assembly assembly1 = null; 

            IEnumerable<Type> myTypes = null;


            #region ScanningDefault

            BusConfiguration busConfiguration = new BusConfiguration();

            #endregion

            #region ScanningExcludeByName

            busConfiguration.AssembliesToScan(AllAssemblies.Except("MyAssembly1.dll").And("MyAssembly2.dll"));

            #endregion

            #region ScanningListOfTypes

            busConfiguration.TypesToScan(myTypes); 

            #endregion

            #region ScanningListOfAssemblies

            busConfiguration.AssembliesToScan(myListOfAssemblies);
            // or
            busConfiguration.AssembliesToScan(assembly1, assembly2);

            #endregion

            #region ScanningIncludeByPattern

            busConfiguration.AssembliesToScan(AllAssemblies.Matching("NServiceBus").And("MyCompany.").And("SomethingElse"));

            #endregion

            #region ScanningCustomDirectory

            busConfiguration.ScanAssembliesInDirectory(@"c:\my-custom-dir");

            #endregion

            #region ScanningMixingIncludeAndExclude

            busConfiguration.AssembliesToScan(AllAssemblies.Matching("NServiceBus").And("MyCompany.").Except("BadAssembly.dll"));

            #endregion

        }
开发者ID:ryanrdl,项目名称:docs.particular.net,代码行数:55,代码来源:ScanningPublicApi.cs

示例3: ConfigureBus

        public static void ConfigureBus(IWindsorContainer container)
        {
            // Use NLog for logging
            NServiceBus.Logging.LogManager.Use<NLogFactory>();

            var configuration = new BusConfiguration();
            // Only scan known Messages assemblies rather than all assemblies in 'bin' - faster startup time.
            var messages = AppDomain.CurrentDomain.GetAssemblies()
                .Where(a => a.GetName().Name.EndsWith(".Messages"));
            configuration.AssembliesToScan(messages);
            // Use NServiceBus Unobtrusive Mode
            configuration.Conventions()
                .DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith("Commands"))
                .DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith("Events"))
                .DefiningMessagesAs(t => t.Namespace != null && t.Namespace == "Messages")
                .DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus"))
                .DefiningExpressMessagesAs(t => t.Name.EndsWith("Express"))
                .DefiningTimeToBeReceivedAs(t => t.Name.EndsWith("Expires")
                    ? TimeSpan.FromSeconds(30) : TimeSpan.MaxValue);
            // Use existing Castle Windsor container
            configuration.UseContainer<WindsorBuilder>(c => c.ExistingContainer(container));
            // Use JSON for serialisation
            configuration.UseSerialization<JsonSerializer>();
            // Use MSMQ for transport
            configuration.UseTransport<MsmqTransport>();
            // Use InMemory persistence only
            configuration.UsePersistence<InMemoryPersistence>();
            configuration.EnableInstallers();

            // Start the bus
            var bus = Bus.Create(configuration);
            bus.Start();
        }
开发者ID:laazyj,项目名称:MessageBusArchitectureExample,代码行数:33,代码来源:BusConfig.cs

示例4: ConfigureAssembliesToScan

 private static void ConfigureAssembliesToScan(BusConfiguration busConfiguration)
 {
     busConfiguration.AssembliesToScan(
         AllAssemblies.Matching("NServiceBus")
             .And("Messages")
             .And("DocumentDownloader"));
 }
开发者ID:seantarogers,项目名称:ReliableSignalRMessaging,代码行数:7,代码来源:EndpointConfig.cs

示例5: ScanningListOfAssemblies

        public void ScanningListOfAssemblies()
        {
            IEnumerable<Assembly> myListOfAssemblies = null;

            Assembly assembly2 = null;
            Assembly assembly1 = null;
            BusConfiguration busConfiguration = new BusConfiguration();

            #region ScanningListOfAssemblies

            busConfiguration.AssembliesToScan(myListOfAssemblies);
            // or
            busConfiguration.AssembliesToScan(assembly1, assembly2);

            #endregion
        }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:16,代码来源:ScanningPublicApi.cs

示例6: SetUp

        public void SetUp()
        {
            Builder = new FuncBuilder();
            InMemoryFaultManager = new NServiceBus.Faults.InMemory.FaultManager();
            FakeReceiver = new FakeReceiver();

            var configurationBuilder = new BusConfiguration();

            configurationBuilder.EndpointName("xyz");
            configurationBuilder.AssembliesToScan(new Assembly[0]);

            Transport = new TransportReceiver(new TransactionSettings(true, TimeSpan.FromSeconds(30), IsolationLevel.ReadCommitted, 5, false, false), 1, 0, FakeReceiver, InMemoryFaultManager, new SettingsHolder(), configurationBuilder.BuildConfiguration());

            RegisterTypes();
            Builder.Register<IManageMessageFailures>(() => InMemoryFaultManager);
            Builder.Register<TransportReceiver>(() => Transport);

            //var configurer = new SatelliteConfigurer();
            //configurer.Customize(configure);

            var launcher = new SatelliteLauncher(Builder);

            BeforeRun();
            launcher.Start();
        }
开发者ID:hyldrim,项目名称:NServiceBus,代码行数:25,代码来源:SatelliteLauncherContext.cs

示例7: Should_always_include_the_core_nservicebus_types

        public void Should_always_include_the_core_nservicebus_types()
        {
             var builder = new BusConfiguration();

            builder.AssembliesToScan(Assembly.GetExecutingAssembly());

            Assert.True(builder.BuildConfiguration().Settings.GetAvailableTypes().Any(a => a.Assembly.GetName().Name.Equals("NServiceBus.Core")));
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:8,代码来源:When_loading_types.cs

示例8: Customize

 public void Customize(BusConfiguration configuration)
 {
     configuration.AssembliesToScan(Assembly.GetExecutingAssembly(), typeof(AxisMessage).Assembly, typeof(ReportStoreMessage).Assembly, typeof(AzureStorageQueueTransport).Assembly);
     configuration.UseTransport<AzureStorageQueueTransport>();
     configuration.UsePersistence<InMemoryPersistence>();
     configuration.EndpointName("50000");
     configuration.Transactions().DoNotWrapHandlersExecutionInATransactionScope();
     configuration.Transactions().Disable();
 }
开发者ID:jaldipp,项目名称:NServiceBus_Repro_DevStorage,代码行数:9,代码来源:EndpointConfig.cs

示例9: Start

        public void Start()
        {
            DynamicHostControllerConfig configSection = null;

            var o = new BusConfiguration();
            o.AssembliesToScan(GetType().Assembly);
            o.AzureConfigurationSource();
            o.RegisterComponents(Configurer =>
            {
                Configurer.ConfigureComponent<DynamicEndpointLoader>(DependencyLifecycle.SingleInstance);
                Configurer.ConfigureComponent<DynamicEndpointProvisioner>(DependencyLifecycle.SingleInstance);
                Configurer.ConfigureComponent<DynamicEndpointRunner>(DependencyLifecycle.SingleInstance);
                Configurer.ConfigureComponent<DynamicHostMonitor>(DependencyLifecycle.SingleInstance);

                configSection = o.GetSettings().GetConfigSection<DynamicHostControllerConfig>() ?? new DynamicHostControllerConfig();

                Configurer.ConfigureProperty<DynamicEndpointLoader>(t => t.ConnectionString, configSection.ConnectionString);
                Configurer.ConfigureProperty<DynamicEndpointLoader>(t => t.Container, configSection.Container);
                Configurer.ConfigureProperty<DynamicEndpointProvisioner>(t => t.LocalResource, configSection.LocalResource);
                Configurer.ConfigureProperty<DynamicEndpointProvisioner>(t => t.RecycleRoleOnError, configSection.RecycleRoleOnError);
                Configurer.ConfigureProperty<DynamicEndpointRunner>(t => t.RecycleRoleOnError, configSection.RecycleRoleOnError);
                Configurer.ConfigureProperty<DynamicEndpointRunner>(t => t.TimeToWaitUntilProcessIsKilled, configSection.TimeToWaitUntilProcessIsKilled);
                Configurer.ConfigureProperty<DynamicHostMonitor>(t => t.Interval, configSection.UpdateInterval);
            });

            o.UsePersistence<AzureStoragePersistence>();
            o.DiscardFailedMessagesInsteadOfSendingToErrorQueue();

            profileManager.ActivateProfileHandlers(o);
            specifier.Customize(o);

            var bus = (UnicastBus)Bus.CreateSendOnly(o);

            loader = bus.Builder.Build<DynamicEndpointLoader>();
            provisioner = bus.Builder.Build<DynamicEndpointProvisioner>();
            runner = bus.Builder.Build<DynamicEndpointRunner>();

            var endpointsToHost = loader.LoadEndpoints();
            if (endpointsToHost == null) return;

            runningServices = new List<EndpointToHost>(endpointsToHost);

            provisioner.Provision(runningServices);

            runner.Start(runningServices);

            if (!configSection.AutoUpdate) return;

            monitor = bus.Builder.Build<DynamicHostMonitor>();
            monitor.UpdatedEndpoints += UpdatedEndpoints;
            monitor.NewEndpoints += NewEndpoints;
            monitor.RemovedEndpoints += RemovedEndpoints;
            monitor.Monitor(runningServices);
            monitor.Start();
        }
开发者ID:mjhilton,项目名称:NServiceBus.Host.AzureCloudService,代码行数:55,代码来源:DynamicHostController.cs

示例10: ScanningExcludeByName

        void ScanningExcludeByName(BusConfiguration busConfiguration)
        {
            #region ScanningExcludeByName

            var excludesBuilder = AllAssemblies
                .Except("MyAssembly1.dll")
                .And("MyAssembly2.dll");
            busConfiguration.AssembliesToScan(excludesBuilder);

            #endregion
        }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:11,代码来源:ScanningPublicApi.cs

示例11: Customize

        public void Customize(BusConfiguration configuration)
        {
            configuration.DisableFeature<TimeoutManager>();
            configuration.AssembliesToScan(typeof(NHibernatePersistence).Assembly, typeof(OrderSaga).Assembly, typeof(OrderPlaced).Assembly);
            //configuration.UsePersistence<InMemoryPersistence>();

            configuration.UsePersistence<NHibernatePersistence>();
            configuration.UseSerialization<JsonSerializer>();

            //configuration.DisableFeature<NHibernateTimeoutStorage>();
        }
开发者ID:tomasking,项目名称:NServiceBusDemo,代码行数:11,代码来源:EndpointConfig.cs

示例12: StartInstance2

    static IBus StartInstance2()
    {
        BusConfiguration busConfiguration = new BusConfiguration();

        busConfiguration.EndpointName("Samples.MultiHosting.Instance2");
        busConfiguration.AssembliesToScan(AllAssemblies.Matching("Instance2.").And("Shared"));
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();

        return Bus.Create(busConfiguration).Start();
    }
开发者ID:ryanrdl,项目名称:docs.particular.net,代码行数:12,代码来源:Program.cs

示例13: ScanningIncludeByPattern

        void ScanningIncludeByPattern(BusConfiguration busConfiguration)
        {
            #region ScanningIncludeByPattern

            var includesBuilder = AllAssemblies
                .Matching("NServiceBus")
                .And("MyCompany.")
                .And("SomethingElse");
            busConfiguration.AssembliesToScan(includesBuilder);

            #endregion
        }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:12,代码来源:ScanningPublicApi.cs

示例14: Simple

        public void Simple()
        {
            #region CustomConfigOverrides

            BusConfiguration busConfiguration = new BusConfiguration();

            busConfiguration.AssembliesToScan(AllAssemblies.Except("NotThis.dll"));
            busConfiguration.Conventions().DefiningEventsAs(type => type.Name.EndsWith("Event"));
            busConfiguration.EndpointName("MyEndpointName");

            #endregion
        }
开发者ID:ryanrdl,项目名称:docs.particular.net,代码行数:12,代码来源:CustomConfigOverrides.cs

示例15: ScanningMixingIncludeAndExclude

        void ScanningMixingIncludeAndExclude(BusConfiguration busConfiguration)
        {
            #region ScanningMixingIncludeAndExclude

            var excludesBuilder = AllAssemblies
                .Matching("NServiceBus")
                .And("MyCompany.")
                .Except("BadAssembly.dll");
            busConfiguration.AssembliesToScan(excludesBuilder);

            #endregion

        }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:13,代码来源:ScanningPublicApi.cs


注:本文中的BusConfiguration.AssembliesToScan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。