示例#1
0
        internal static IHttpReportsBuilder UseMySqlStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, MySqlStorage>();
            builder.Services.AddSingleton <MySqlConnectionFactory>();

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

            return(builder.AddPostgreSQLStorageService());
        }
示例#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);
        }
示例#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());
 }
        internal static IHttpReportsBuilder UsePostgreSQLStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, PostgreSQLStorage>();
            builder.Services.AddSingleton <PostgreConnectionFactory>();

            return(builder);
        }
示例#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());
        }
示例#8
0
        public static IHttpReportsBuilder UseMySqlStorage(this IHttpReportsBuilder builder, Action <MySqlStorageOptions> options)
        {
            builder.Services.AddOptions();
            builder.Services.Configure <MySqlStorageOptions>(options);

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

            return(builder.AddSQLServerStorageService());
        }
示例#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);
 }
示例#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);
        }
示例#17
0
 public static IHttpReportsBuilder AddHttpTransport(this IHttpReportsBuilder builder, Action <HttpTransportOptions> options)
 {
     builder.Services.AddOptions().Configure(options);
     return(builder.AddHttpTransportService());
 }
        private static IHttpReportsBuilder AddSQLServerStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, SQLServerStorage>();

            return(builder);
        }
示例#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());
 }
示例#24
0
        internal static IHttpReportsBuilder AddMySqlStorageService(this IHttpReportsBuilder builder)
        {
            builder.Services.AddSingleton <IHttpReportsStorage, MySqlStorage>();

            return(builder);
        }
示例#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);
 }
示例#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);
 }