本文整理汇总了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
}
示例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
}
示例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();
}
示例4: ConfigureAssembliesToScan
private static void ConfigureAssembliesToScan(BusConfiguration busConfiguration)
{
busConfiguration.AssembliesToScan(
AllAssemblies.Matching("NServiceBus")
.And("Messages")
.And("DocumentDownloader"));
}
示例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
}
示例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();
}
示例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")));
}
示例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();
}
示例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();
}
示例10: ScanningExcludeByName
void ScanningExcludeByName(BusConfiguration busConfiguration)
{
#region ScanningExcludeByName
var excludesBuilder = AllAssemblies
.Except("MyAssembly1.dll")
.And("MyAssembly2.dll");
busConfiguration.AssembliesToScan(excludesBuilder);
#endregion
}
示例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>();
}
示例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();
}
示例13: ScanningIncludeByPattern
void ScanningIncludeByPattern(BusConfiguration busConfiguration)
{
#region ScanningIncludeByPattern
var includesBuilder = AllAssemblies
.Matching("NServiceBus")
.And("MyCompany.")
.And("SomethingElse");
busConfiguration.AssembliesToScan(includesBuilder);
#endregion
}
示例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
}
示例15: ScanningMixingIncludeAndExclude
void ScanningMixingIncludeAndExclude(BusConfiguration busConfiguration)
{
#region ScanningMixingIncludeAndExclude
var excludesBuilder = AllAssemblies
.Matching("NServiceBus")
.And("MyCompany.")
.Except("BadAssembly.dll");
busConfiguration.AssembliesToScan(excludesBuilder);
#endregion
}