コード例 #1
0
 public static MagnetServerBuilder AddSignalR(
     this MagnetServerBuilder builder)
 {
     builder.Services.AddSignalR();
     builder.Services.AddSingleton <MessageListener>();
     return(builder);
 }
コード例 #2
0
 public static MagnetServerBuilder AddAzureDevOps(this MagnetServerBuilder builder)
 {
     builder.Services.AddControllers()
     .AddApplicationPart(typeof(WorkItemController).Assembly);
     builder.Services.AddSingleton <WorkItemEventDeserializer>();
     return(builder);
 }
コード例 #3
0
        public static MagnetServerBuilder AddRabbitMQ(
            this MagnetServerBuilder builder,
            IConfiguration configuration)
        {
            IConfigurationSection section = configuration.GetSection("Magnet:RabbitMQ");
            RabbitMQOptions       options = section.Get <RabbitMQOptions>();

            builder.AddRabbitMQ(options);
            return(builder);
        }
コード例 #4
0
        public static MagnetServerBuilder AddMagnet(this IServiceCollection services)
        {
            var builder = new MagnetServerBuilder(services);

            services.AddSingleton <IMessageSink, MessageSink>();
            services.AddSingleton <IMessageStore, InMemoryMessageStore>();
            services.AddSingleton <DataChangeTracker>();
            services.AddAutoMapper(typeof(MappingProfile));
            return(builder);
        }
コード例 #5
0
        public static MagnetServerBuilder AddRabbitMQ(
            this MagnetServerBuilder builder,
            RabbitMQOptions options)
        {
            builder.Services.AddSingleton(options);
            builder.Services.AddSingleton <IMessageBus, MessageBus>();

            var conn = new ConnectionFactory()
            {
                HostName = options.Hostname,
                Port     = options.Port
            };

            if (options.UserName != null)
            {
                conn.UserName = options.UserName;
                conn.Password = options.Password;
            }

            builder.Services.AddSingleton(conn);
            return(builder);
        }
コード例 #6
0
 public static MagnetServerBuilder AddSendGridEmail(this MagnetServerBuilder builder)
 {
     builder.Services.AddControllers()
     .AddApplicationPart(typeof(EmailController).Assembly);
     return(builder);
 }
コード例 #7
0
 public static MagnetServerBuilder AddTwilioSms(this MagnetServerBuilder builder)
 {
     builder.Services.AddControllers()
     .AddApplicationPart(typeof(SmsController).Assembly);
     return(builder);
 }