本文整理汇总了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)));
}
示例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();
}
示例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>();
}
示例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")));
}
示例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>();
}
示例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);
}
示例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);
}
示例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);
}
示例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())));
}