Ejemplo n.º 1
0
        internal static IHttpReportsBuilder UseMySqlStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, MySqlStorage>();
            builder.Services.AddSingleton <MySqlConnectionFactory>();

            return(builder);
        }
Ejemplo n.º 2
0
        public static IHttpReportsBuilder UsePostgreSQLStorage(this IHttpReportsBuilder builder, Action <PostgreStorageOptions> options)
        {
            builder.Services.AddOptions();
            builder.Services.Configure <PostgreStorageOptions>(options);

            return(builder.AddPostgreSQLStorageService());
        }
Ejemplo n.º 3
0
        public static IHttpReportsBuilder UseAutoStorage(this IHttpReportsBuilder builder, StorageOptions options)
        {
            if (options.StorageType.ToUpper() == "MYSQL")
            {
                builder = builder.UseMySqlStorage(x => {
                    x.ConnectionString = options.ConnectionString;
                });
            }

            if (options.StorageType.ToUpper() == "ORACLE")
            {
                builder = builder.UseOracleStorage(x => {
                    x.ConnectionString = options.ConnectionString;
                });
            }

            if (options.StorageType.ToUpper() == "SQLSERVER" || options.StorageType.ToUpper() == "SQL SERVER")
            {
                builder = builder.UseSQLServerStorage(x => {
                    x.ConnectionString = options.ConnectionString;
                });
            }

            if (options.StorageType.ToUpper() == "PostgreSQL")
            {
                builder = builder.UsePostgreSQLStorage(x => {
                    x.ConnectionString = options.ConnectionString;
                });
            }

            return(builder);
        }
Ejemplo n.º 4
0
 private static IHttpReportsBuilder UseSQLServerStorageService(this IHttpReportsBuilder builder)
 {
     builder.Services.AddTransient <IHttpReportsStorage, SQLServerStorage>();
     builder.Services.AddSingleton <SQLServerConnectionFactory>();
     builder.Services.AddSingleton <IModelCreator, ModelCreator>();
     return(builder.UseDirectlyReportsTransport());
 }
Ejemplo n.º 5
0
        internal static IHttpReportsBuilder UsePostgreSQLStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, PostgreSQLStorage>();
            builder.Services.AddSingleton <PostgreConnectionFactory>();

            return(builder);
        }
Ejemplo n.º 6
0
 public static IHttpReportsBuilder UseOracleStorageService(this IHttpReportsBuilder builder)
 {
     builder.Services.AddTransient <IHttpReportsStorage, OracleStorage>();
     builder.Services.AddSingleton <OracleConnectionFactory>();
     builder.Services.AddSingleton <IModelCreator, ModelCreator>();
     return(builder);
 }
        public static IHttpReportsBuilder UseSQLServerStorage(this IHttpReportsBuilder builder)
        {
            builder.Services.AddOptions();
            builder.Services.Configure <SQLServerStorageOptions>(builder.Configuration.GetSection("Storage"));

            return(builder.UseSQLServerStorageService());
        }
Ejemplo n.º 8
0
        public static IHttpReportsBuilder UseMySqlStorage(this IHttpReportsBuilder builder, Action <MySqlStorageOptions> options)
        {
            builder.Services.AddOptions();
            builder.Services.Configure <MySqlStorageOptions>(options);

            return(builder.UseMySqlStorageService());
        }
Ejemplo n.º 9
0
        public static IHttpReportsBuilder AddSQLServerStorage(this IHttpReportsBuilder builder, Action <SQLServerStorageOptions> options)
        {
            builder.Services.AddOptions();
            builder.Services.Configure <SQLServerStorageOptions>(options);

            return(builder.AddSQLServerStorageService());
        }
Ejemplo n.º 10
0
        internal static IHttpReportsBuilder UseSQLiteStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, SQLiteStorage>();
            builder.Services.AddSingleton <SQLiteConnectionFactory>();

            return(builder.UseDirectlyReportsTransport());
        }
 public static IHttpReportsBuilder UseGrpcReportsTransport(this IHttpReportsBuilder builder)
 {
     builder.Services.RemoveAll <IReportsTransport>();
     builder.Services.AddSingleton <IReportsTransport, GrpcReportsTransport>();
     builder.Services.RemoveAll <IModelCreator>();
     builder.Services.AddSingleton <IModelCreator, ModelCreator>();
     return(builder);
 }
Ejemplo n.º 12
0
        public static IHttpReportsBuilder UseMySqlStorage(this IHttpReportsBuilder builder)
        {
            builder.Services.AddOptions();
            builder.Services.Configure <MySqlStorageOptions>(builder.Configuration.GetSection("Storage"));
            builder.Services.AddSingleton <IHttpReportsStorage, MySqlStorage>();
            builder.Services.AddSingleton <MySqlConnectionFactory>();

            return(builder);
        }
 public static IHttpReportsBuilder UseSQLServerStorage(this IHttpReportsBuilder builder)
 {
     builder.Services.AddOptions();
     builder.Services.Configure <SQLServerStorageOptions>(builder.Configuration.GetSection("Storage"));
     builder.Services.AddTransient <IHttpReportsStorage, SQLServerStorage>();
     builder.Services.AddSingleton <SQLServerConnectionFactory>();
     builder.Services.AddSingleton <IModelCreator, ModelCreator>();
     return(builder);
 }
        public static IHttpReportsBuilder UseDirectlyReportsTransport(this IHttpReportsBuilder builder)
        {
            builder.Services.RemoveAll <IReportsTransport>();
            builder.Services.AddSingleton <IReportsTransport, DirectlyReportsTransport>();
            builder.Services.RemoveAll <IModelCreator>();
            builder.Services.AddSingleton <IModelCreator, DefaultModelCreator>();

            return(builder);
        }
        private static IHttpReportsBuilder UseHttpTransportService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddHttpClient(BasicConfig.HttpReportsHttpClient, client => {
                client.DefaultRequestHeaders.Clear();
                client.Timeout = TimeSpan.FromSeconds(5);
            });

            builder.Services.RemoveAll <IReportsTransport>();
            builder.Services.AddSingleton <IReportsTransport, HttpTransport>();
            return(builder);
        }
        public static IHttpReportsBuilder UseHttpTransport(this IHttpReportsBuilder builder)
        {
            builder.Services.AddHttpClient(BasicConfig.HttpReportsHttpClient, client => {
                client.DefaultRequestHeaders.Clear();
                client.Timeout = TimeSpan.FromSeconds(30);
                client.DefaultRequestHeaders.Add("Content-Type", "application/json; charset=utf-8");
            });

            builder.Services.RemoveAll <IReportsTransport>();
            builder.Services.AddSingleton <IReportsTransport, HttpTransport>();
            builder.Services.RemoveAll <IModelCreator>();
            builder.Services.AddSingleton <IModelCreator, ModelCreator>();
            return(builder);
        }
Ejemplo n.º 17
0
 public static IHttpReportsBuilder AddHttpTransport(this IHttpReportsBuilder builder, Action <HttpTransportOptions> options)
 {
     builder.Services.AddOptions().Configure(options);
     return(builder.AddHttpTransportService());
 }
Ejemplo n.º 18
0
        private static IHttpReportsBuilder AddSQLServerStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, SQLServerStorage>();

            return(builder);
        }
Ejemplo n.º 19
0
        private static IHttpReportsBuilder UseSQLServerStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddTransient <IHttpReportsStorage, SQLServerStorage>();

            return(builder);
        }
 public static IHttpReportsBuilder UseGrpcReportsTransport(this IHttpReportsBuilder builder, Action <GrpcReportsTransportOptions> options)
 {
     builder.Services.AddOptions()
     .Configure(options);
     return(builder);
 }
 public static IHttpReportsBuilder UseGrpcReportsTransport(this IHttpReportsBuilder builder, IConfiguration configuration)
 {
     builder.Services.AddOptions()
     .Configure <GrpcReportsTransportOptions>(configuration);
     return(builder.UseGrpcReportsTransport());
 }
 public static IHttpReportsBuilder UseHttpTransport(this IHttpReportsBuilder builder)
 {
     builder.Services.AddOptions().Configure <HttpTransportOptions>(builder.Configuration.GetSection("Transport"));
     return(builder.UseHttpTransportService());
 }
 public static IHttpReportsBuilder AddHttpTransport(this IHttpReportsBuilder builder, IConfiguration configuration)
 {
     return(builder.AddHttpTransportService());
 }
Ejemplo n.º 24
0
        internal static IHttpReportsBuilder AddMySqlStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, MySqlStorage>();

            return(builder);
        }
Ejemplo n.º 25
0
 private static IHttpReportsBuilder UseWeb(this IHttpReportsBuilder builder)
 {
     builder.Services.AddSingleton <IRequestInfoBuilder, WebRequestInfoBuilder>();
     return(builder);
 }
 private static IHttpReportsBuilder AddGrpcTransportService(this IHttpReportsBuilder builder)
 {
     builder.Services.RemoveAll <IReportsTransport>();
     builder.Services.AddSingleton <IReportsTransport, GrpcTransport>();
     return(builder);
 }
Ejemplo n.º 27
0
        public static IHttpReportsBuilder UseGrpc(this IHttpReportsBuilder builder)
        {
            builder.Services.AddGrpc(x => { x.Interceptors.Add <HttpReportsGrpcLoggerInterceptor>(); });

            return(builder);
        }
 public static IHttpReportsBuilder AddGrpcCollector(this IHttpReportsBuilder builder)
 {
     builder.Services.AddGrpc();
     return(builder);
 }