本文整理汇总了C#中EndpointConfiguration.UsePersistence方法的典型用法代码示例。如果您正苦于以下问题:C# EndpointConfiguration.UsePersistence方法的具体用法?C# EndpointConfiguration.UsePersistence怎么用?C# EndpointConfiguration.UsePersistence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EndpointConfiguration
的用法示例。
在下文中一共展示了EndpointConfiguration.UsePersistence方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Usage
public void Usage()
{
EndpointConfiguration configuration = new EndpointConfiguration();
#region DisableSchemaUpdate
configuration.UsePersistence<NHibernatePersistence>()
.DisableSchemaUpdate();
#endregion
#region DisableGatewaySchemaUpdate
configuration.UsePersistence<NHibernatePersistence>()
.DisableGatewayDeduplicationSchemaUpdate();
#endregion
#region DisableSubscriptionSchemaUpdate
configuration.UsePersistence<NHibernatePersistence>()
.DisableSubscriptionStorageSchemaUpdate();
#endregion
#region DisableTimeoutSchemaUpdate
configuration.UsePersistence<NHibernatePersistence>()
.DisableTimeoutStorageSchemaUpdate();
#endregion
}
示例2: Usage
Usage(EndpointConfiguration endpointConfiguration)
{
#region ConfiguringInMemory
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Sagas>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Outbox>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
#endregion
}
示例3: Setup
void Setup(EndpointConfiguration endpointConfiguration)
{
#region PersistenceOrder_Correct
endpointConfiguration.UsePersistence<RavenDBPersistence>();
endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
#endregion
}
示例4: Setup2
void Setup2(EndpointConfiguration endpointConfiguration)
{
#region PersistenceOrder_Incorrect
endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
// This one will override the above settings!
endpointConfiguration.UsePersistence<RavenDBPersistence>();
#endregion
}
示例5: Setup3
void Setup3(EndpointConfiguration endpointConfiguration)
{
#region PersistenceOrder_Explicit
endpointConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
endpointConfiguration.UsePersistence<RavenDBPersistence, StorageType.Sagas>();
endpointConfiguration.UsePersistence<RavenDBPersistence, StorageType.Subscriptions>();
endpointConfiguration.UsePersistence<RavenDBPersistence, StorageType.Timeouts>();
#endregion
}
示例6: ConfiguringInMemory
public void ConfiguringInMemory()
{
#region ConfiguringInMemory
EndpointConfiguration configuration = new EndpointConfiguration();
configuration.UsePersistence<InMemoryPersistence, StorageType.Sagas>();
configuration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>();
configuration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>();
configuration.UsePersistence<InMemoryPersistence, StorageType.Outbox>();
configuration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
#endregion
}
示例7: AsyncMain
static async Task AsyncMain()
{
#region sqlrelay-config
EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.EndpointName("SqlRelay");
endpointConfiguration.EnableInstallers();
endpointConfiguration.DisableFeature<AutoSubscribe>();
endpointConfiguration.UsePersistence<NHibernatePersistence>()
.ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
endpointConfiguration.UseTransport<SqlServerTransport>()
.ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
#endregion
IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
try
{
Console.WriteLine("\r\nSqlRelay is running - This endpoint will relay all events received to subscribers. Press any key to stop program\r\n");
Console.ReadKey();
}
finally
{
await endpoint.Stop();
}
}
示例8: Customize
public void Customize(EndpointConfiguration endpointConfiguration)
{
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.UsePersistence<InMemoryPersistence>();
}
示例9: Application_Start
protected void Application_Start()
{
#region ApplicationStart
ContainerBuilder builder = new ContainerBuilder();
// Register MVC controllers.
builder.RegisterControllers(typeof(MvcApplication).Assembly);
// Set the dependency resolver to be Autofac.
IContainer container = builder.Build();
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MvcInjection.WebApplication");
// instruct NServiceBus to use a custom AutoFac configuration
endpointConfiguration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.SendFailedMessagesTo("error");
endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();
ContainerBuilder updater = new ContainerBuilder();
updater.RegisterInstance(endpoint);
updater.Update(container);
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
#endregion
}
示例10: GetConfiguration
public Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action<EndpointConfiguration> configurationBuilderCustomization)
{
var types = GetTypesScopedByTestClass(endpointConfiguration);
typesToInclude.AddRange(types);
var builder = new EndpointConfiguration(endpointConfiguration.EndpointName);
builder.TypesToIncludeInScan(typesToInclude);
builder.CustomConfigurationSource(configSource);
builder.EnableInstallers();
builder.DisableFeature<TimeoutManager>();
builder.Recoverability()
.Delayed(delayed => delayed.NumberOfRetries(0))
.Immediate(immediate => immediate.NumberOfRetries(0));
builder.RegisterComponents(r => { RegisterInheritanceHierarchyOfContextOnContainer(runDescriptor, r); });
builder.UsePersistence<InMemoryPersistence>();
configurationBuilderCustomization(builder);
return Task.FromResult(builder);
}
示例11: AsyncMain
static async Task AsyncMain()
{
EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.Routing()
.UnicastRoutingTable
.RouteToEndpoint(typeof(DoSomething), "Server");
IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
Console.WriteLine("Press enter to send a message");
Console.WriteLine("Press any key to exit");
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
if (key.Key != ConsoleKey.Enter)
{
break;
}
await endpoint.Send(new DoSomething());
Console.WriteLine("Message Sent");
}
await endpoint.Stop();
}
示例12: AsyncMain
static async Task AsyncMain()
{
Console.Title = "Samples.Logging.CustomFactory";
#region ConfigureLogging
var loggerDefinition = LogManager.Use<ConsoleLoggerDefinition>();
// optionally set the log level in code or read from app.config
loggerDefinition.Level(LogLevel.Info);
// logging configuration should occur prior to endpoint configuration
var endpointConfiguration = new EndpointConfiguration("Samples.Logging.CustomFactory");
#endregion
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
var endpointInstance = await Endpoint.Start(endpointConfiguration)
.ConfigureAwait(false);
try
{
var myMessage = new MyMessage();
await endpointInstance.SendLocal(myMessage)
.ConfigureAwait(false);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
finally
{
await endpointInstance.Stop()
.ConfigureAwait(false);
}
}
示例13: AsyncMain
static async Task AsyncMain()
{
Console.Title = "Samples.Throttling.Limited";
#region LimitConcurrency
var endpointConfiguration = new EndpointConfiguration("Samples.Throttling.Limited");
endpointConfiguration.LimitMessageProcessingConcurrencyTo(1);
#endregion
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.SendFailedMessagesTo("error");
#region RegisterBehavior
endpointConfiguration.Pipeline.Register<ThrottlingRegistration>();
#endregion
var endpointInstance = await Endpoint.Start(endpointConfiguration)
.ConfigureAwait(false);
try
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
finally
{
await endpointInstance.Stop()
.ConfigureAwait(false);
}
}
示例14: AsyncMain
static async Task AsyncMain()
{
Console.Title = "Samples.Logging.CommonLogging";
#region ConfigureLogging
Common.Logging.LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter
{
Level = LogLevel.Info
};
NServiceBus.Logging.LogManager.Use<CommonLoggingFactory>();
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Logging.CommonLogging");
#endregion
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.SendFailedMessagesTo("error");
IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
try
{
await endpoint.SendLocal(new MyMessage());
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
finally
{
await endpoint.Stop();
}
}
示例15: AsyncMain
static async Task AsyncMain()
{
EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
endpointConfiguration.EndpointName("Samples.NHibernateCustomSagaFinder");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.EnableInstallers();
#region NHibernateSetup
endpointConfiguration.UsePersistence<NHibernatePersistence>()
.ConnectionString(@"Data Source=.\SqlExpress;Initial Catalog=NHCustomSagaFinder;Integrated Security=True");
#endregion
IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
try
{
await endpoint.SendLocal(new StartOrder
{
OrderId = "123"
});
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
finally
{
await endpoint.Stop();
}
}