Ejemplo n.º 1
0
        public InfluxDbContext(InfluxDBOptions options)
        {
            Options = options;
            var client = new InfluxDbClient(options.Host, options.UserName, options.Password, InfluxDbVersion.v_1_0_0);

            this.Client   = client.Client;
            this.Database = client.Database;
            Ensure().Wait();
        }
        public static void UseInfluxDbEventStorage(this ShriekOptionBuilder builder, Action <InfluxDBOptions> optionAction)
        {
            var options = new InfluxDBOptions();

            optionAction(options);

            builder.Services.AddScoped(x => options);
            builder.Services.AddScoped <InfluxDbContext>();
            builder.Services.AddScoped <IEventStorageRepository, EventStorageRepository>();
            builder.Services.AddScoped <IMementoRepository, MementoRepository>();
            builder.Services.AddScoped <IEventStorage, DefalutEventStorage>();
        }
        public static IShriekBuilder AddInfluxDbEventStorage(this IShriekBuilder builder,
                                                             Action <InfluxDBOptions> optionAction)
        {
            var options = new InfluxDBOptions();

            optionAction(options);

            builder.Services.AddScoped(x => options);
            builder.Services.AddScoped <InfluxDbContext>();
            builder.Services.AddScoped <IEventStorageRepository, EventStorageRepository>();
            builder.Services.AddScoped <IMementoRepository, MementoRepository>();
            builder.Services.AddScoped <IEventStorage, SqlEventStorage>();

            return(builder);
        }