public static IStorageBuilder AddSqlServerQueue(this IStorageBuilder builder, string name, Action <SqlServerQueueOptions> configure)
 {
     builder.AddQueueClient <SqlServerQueueClient, SqlServerQueueOptions>(name, configure);
     builder.Services.AddDbContext <QueueDbContext>((serviceProvider, dbContextBuilder) =>
     {
         var optionsMonitor = serviceProvider.GetRequiredService <IOptionsMonitor <SqlServerQueueOptions> >();
         var options        = optionsMonitor.Get(Helpers.GetQualifiedQueueName(name));
         dbContextBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
         dbContextBuilder.UseSqlServer(options.ConnectionString);
     }, ServiceLifetime.Singleton, ServiceLifetime.Singleton);
     return(builder);
 }
示例#2
0
 public static IStorageBuilder AddAzureQueue(this IStorageBuilder storageBuilder, string name, ServiceLifetime serviceLifetime, Action <AzureQueueConfiguration> configure)
 {
     storageBuilder.AddQueueClient <AzureQueueClient>(name, serviceLifetime).Configure(configure);
     return(storageBuilder);
 }
示例#3
0
 public static IStorageBuilder AddRabbitMqQueue(this IStorageBuilder builder, string name, Action <RabbitMqQueueOptions> configure)
 {
     builder.AddQueueClient <RabbitMqQueueClient, RabbitMqQueueOptions>(name, configure);
     return(builder);
 }