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


C# BusConfiguration.TypesToScan方法代码示例

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


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

示例1: Should_not_throw_propertyType_is_not_serializable_if_a_IDataBusSerializer_is_already_registered

        public void Should_not_throw_propertyType_is_not_serializable_if_a_IDataBusSerializer_is_already_registered()
        {
            if (!Debugger.IsAttached)
            {
                Assert.Ignore("This only work in debug mode.");
            }

            var builder = new BusConfiguration();
            builder.EndpointName("xyz");
            builder.TypesToScan(new[]
                {
                    typeof(MessageWithNonSerializableDataBusProperty)
                });
            builder.Conventions().DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus"));
            builder.RegisterComponents(c =>
            {
                c.RegisterSingleton<IDataBus>(new InMemoryDataBus());
                c.ConfigureComponent<IDataBusSerializer>(() => new MyDataBusSerializer(), DependencyLifecycle.SingleInstance);
            });

            var config = builder.BuildConfiguration();
            var feature = new DataBus();

            Assert.DoesNotThrow(() => feature.CheckPrerequisites(new FeatureConfigurationContext(config)));
        }
开发者ID:ogdenmd,项目名称:NServiceBus,代码行数:25,代码来源:When_nservicebus_is_initalizing.cs

示例2: GetConfiguration

        public BusConfiguration GetConfiguration(RunDescriptor runDescriptor, EndpointConfiguration endpointConfiguration, IConfigurationSource configSource, Action<BusConfiguration> configurationBuilderCustomization)
        {
            var settings = runDescriptor.Settings;

            LogManager.UseFactory(new ContextAppender(runDescriptor.ScenarioContext, endpointConfiguration.EndpointName));

            var types = GetTypesScopedByTestClass(endpointConfiguration);

            typesToInclude.AddRange(types);

            var builder = new BusConfiguration();

            builder.EndpointName(endpointConfiguration.EndpointName);
            builder.TypesToScan(typesToInclude);
            builder.CustomConfigurationSource(configSource);
            builder.EnableInstallers();
            builder.DefineTransport(settings, endpointConfiguration.BuilderType);
            builder.DefineTransactions(settings);
            builder.DefineBuilder(settings);
            builder.RegisterComponents(r =>
            {
                r.RegisterSingleton(runDescriptor.ScenarioContext.GetType(), runDescriptor.ScenarioContext);
                r.RegisterSingleton(typeof(ScenarioContext), runDescriptor.ScenarioContext);
            });


            SetSerializer(settings, builder);
            builder.DefinePersistence(settings);

            builder.GetSettings().SetDefault("ScaleOut.UseSingleBrokerQueue", true);
            configurationBuilderCustomization(builder);


            return builder;
        }
开发者ID:hmemcpy,项目名称:NServiceBus.Jil,代码行数:35,代码来源:DefaultServer.cs

示例3: GetConfiguration

        public BusConfiguration GetConfiguration(RunDescriptor runDescriptor, EndpointConfiguration endpointConfiguration, IConfigurationSource configSource, Action<BusConfiguration> configurationBuilderCustomization)
        {
            var settings = runDescriptor.Settings;

            var types = GetTypesToUse(endpointConfiguration);

            var config = new BusConfiguration();
            config.EndpointName(endpointConfiguration.EndpointName);
            config.TypesToScan(types);
            config.CustomConfigurationSource(configSource);
            config.UsePersistence<InMemoryPersistence>();
            config.PurgeOnStartup(true);

            // Plugin a behavior that listens for subscription messages
            config.Pipeline.Register<SubscriptionBehavior.Registration>();
            config.RegisterComponents(c => c.ConfigureComponent<SubscriptionBehavior>(DependencyLifecycle.InstancePerCall));
            
            // Important: you need to make sure that the correct ScenarioContext class is available to your endpoints and tests
            config.RegisterComponents(r =>
            {
                r.RegisterSingleton(runDescriptor.ScenarioContext.GetType(), runDescriptor.ScenarioContext);
                r.RegisterSingleton(typeof(ScenarioContext), runDescriptor.ScenarioContext);
            });

            // Call extra custom action if provided
            if (configurationBuilderCustomization != null)
            {
                configurationBuilderCustomization(config);
            }

            return config;
        }
开发者ID:narnau,项目名称:NServiceBus.AcceptanceTesting,代码行数:32,代码来源:DefaultServer.cs

示例4: ScanningListOfTypes

        void ScanningListOfTypes(BusConfiguration busConfiguration, IEnumerable<Type> myTypes)
        {
            #region ScanningListOfTypes

            busConfiguration.TypesToScan(myTypes);

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

示例5: 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

示例6: ScanningListOfTypes

        public void ScanningListOfTypes()
        {
            IEnumerable<Type> myTypes = null;
            BusConfiguration busConfiguration = new BusConfiguration();

            #region ScanningListOfTypes

            busConfiguration.TypesToScan(myTypes);

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

示例7: Databus_should_not_be_activated_if_no_databus_property_is_found

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

            builder.EndpointName("xyz");
            builder.TypesToScan(new[] { typeof(MessageWithoutDataBusProperty) });

            var feature = new DataBus();

            Assert.False(feature.CheckPrerequisites(new FeatureConfigurationContext(builder.BuildConfiguration())).IsSatisfied);
        }
开发者ID:ogdenmd,项目名称:NServiceBus,代码行数:11,代码来源:When_nservicebus_is_initalizing.cs

示例8: Databus_should_be_activated_if_a_databus_property_is_found

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

            builder.EndpointName("xyz");
            builder.TypesToScan(new[]{typeof(MessageWithDataBusProperty)});
            builder.RegisterComponents(c => c.ConfigureComponent<InMemoryDataBus>(DependencyLifecycle.SingleInstance));
            
            var config = builder.BuildConfiguration();

            Assert.True(new DataBus().CheckPrerequisites(new FeatureConfigurationContext(config)).IsSatisfied);
        }
开发者ID:ogdenmd,项目名称:NServiceBus,代码行数:12,代码来源:When_nservicebus_is_initalizing.cs

示例9: Should_construct_serializer_that_uses_requested_encoding

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

            builder.TypesToScan(new Type[0]);
            builder.UseSerialization<JsonSerializer>().Encoding(Encoding.UTF7);

            var config = builder.BuildConfiguration();

            var context = new FeatureConfigurationContext(config);
            new JsonSerialization().SetupFeature(context);

            var serializer = config.Builder.Build<JsonMessageSerializer>();
            Assert.AreSame(Encoding.UTF7, serializer.Encoding);
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:15,代码来源:When_overriding_stream_encoding.cs

示例10: Should_throw_if_propertyType_is_not_serializable

        public void Should_throw_if_propertyType_is_not_serializable()
        {
            if (!Debugger.IsAttached)
            {
                Assert.Ignore("This only work in debug mode.");
            }

            var builder = new BusConfiguration();
            builder.EndpointName("xyz");
            builder.TypesToScan(new[]
                {
                    typeof(MessageWithNonSerializableDataBusProperty)
                });
            builder.Conventions().DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus"));
            
            var feature = new DataBus();

            Assert.Throws<InvalidOperationException>(() => feature.CheckPrerequisites(new FeatureConfigurationContext(builder.BuildConfiguration())));
        }
开发者ID:ogdenmd,项目名称:NServiceBus,代码行数:19,代码来源:When_nservicebus_is_initalizing.cs

示例11: Simple

    public void Simple()
    {
        // Autofac
        var listOfAssemblies = new List<Assembly>();
        var listOfTypes = new List<Type>();
        string directoryToProbe = null;

        #region TypeScanningV4

        var configuration = new BusConfiguration();

        configuration.AssembliesToScan(listOfAssemblies);

        // or
        configuration.TypesToScan(listOfTypes);

        //or
        configuration.ScanAssembliesInDirectory(directoryToProbe);

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


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