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


C# BusConfiguration.BuildConfiguration方法代码示例

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


在下文中一共展示了BusConfiguration.BuildConfiguration方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: Create

        /// <summary>
        /// Creates a bus instance with the given configuration
        /// </summary>
        /// <param name="configuration">The configuration to use</param>
        /// <returns></returns>
        public static IStartableBus Create(BusConfiguration configuration)
        {
            var config = configuration.BuildConfiguration();

            config.Initialize();

            return config.Builder.Build<IStartableBus>();
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:13,代码来源:Bus.cs

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

示例5: CreateSendOnly

        /// <summary>
        /// Creates a bus instance to be used in send only mode
        /// </summary>
        /// <param name="configuration">The configuration to use</param>
        /// <returns></returns>
        public static ISendOnlyBus CreateSendOnly(BusConfiguration configuration)
        {
            configuration.GetSettings().Set("Endpoint.SendOnly", true);

            var config = configuration.BuildConfiguration();

            config.Initialize();

            return config.Builder.Build<ISendOnlyBus>();
        }
开发者ID:xqfgbc,项目名称:NServiceBus,代码行数:15,代码来源:Bus.cs

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

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

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

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


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