public static MagnetServerBuilder AddAzureServiceBus(
     this MagnetServerBuilder builder,
     AzureServiceBusOptions options)
 {
     builder.Services.AddSingleton(options);
     builder.Services.AddSingleton <IMessageBus, MessageBus>();
     return(builder);
 }
        public static MagnetServerBuilder AddAzureServiceBus(
            this MagnetServerBuilder builder,
            Action <AzureServiceBusOptions> setup)
        {
            var options = new AzureServiceBusOptions();

            setup.Invoke(options);
            return(builder.AddAzureServiceBus(options));
        }
        public static MagnetServerBuilder AddAzureServiceBus(
            this MagnetServerBuilder builder,
            IConfiguration configuration)
        {
            IConfigurationSection  section      = configuration.GetSection("Magnet:ServiceBus");
            AzureServiceBusOptions azureOptions = section.Get <AzureServiceBusOptions>();

            builder.AddAzureServiceBus(azureOptions);
            return(builder);
        }
Exemple #4
0
 public static MagnetServerBuilder AddMongoStore(
     this MagnetServerBuilder builder,
     DatabaseOptions options)
 {
     builder.SetMessageStore <MessageStore>();
     builder.Services.AddSingleton(options);
     builder.Services.AddSingleton((c) =>
                                   new MessageDbContext(new MongoClient(options.ConnectionString), options));
     return(builder);
 }
Exemple #5
0
        public static MagnetServerBuilder AddMongoStore(
            this MagnetServerBuilder builder,
            IConfiguration configuration)
        {
            IConfigurationSection section = configuration.GetSection("Magnet:MongoDb");
            DatabaseOptions       options = section.Get <DatabaseOptions>();

            if (options?.ConnectionString != null)
            {
                builder.AddMongoStore(options);
            }
            return(builder);
        }