예제 #1
0
        public static INeoMonitorModuleBuilder AddInternalServices(this INeoMonitorModuleBuilder builder, IConfiguration configuration)
        {
            var services = builder.Services;

            services
            .AddInternalOptions(configuration)
            .AddInternalDbContexts(configuration)
            .AddInternalCaches();

            services
            .AddNeoRpcHttpClient(c => c.ApiVersion = new Version(2, 0))
            .AddNeoJsonRpcAPIs();

            services
            .AddSingleton <ScopedDbContextFactory>()
            .AddSingleton <NodeSynchronizer>();

            services
            .AddTransient <INodeSeedsLoaderFactory, NodeSeedsLoaderFactory>()
            .AddTransient <IStartupFilter, NodeSeedsStartupFilter>();

            services.AddInternalHostedServices();

            return(builder);
        }
예제 #2
0
        public static INeoMonitorModuleBuilder AddThirdPartyServices(this INeoMonitorModuleBuilder builder)
        {
            var services = builder.Services;

            services.AddAutoMapper(typeof(AutoMapperProfile));
            services.AddSwaggerDocument(config =>
            {
                config.PostProcess = document =>
                {
                    document.Info.Version        = "v1";
                    document.Info.Title          = "NeoMonitor APIs";
                    document.Info.Description    = "APIs of NeoMonitor-Server";
                    document.Info.TermsOfService = "None";
                    document.Info.Contact        = new NSwag.OpenApiContact
                    {
                        Name  = "Github Repository",
                        Email = string.Empty,
                        Url   = "https://github.com/alienworks/NeoMonitor-Server"
                    };
                    //document.Info.License = new NSwag.OpenApiLicense
                    //{
                    //};
                };
            });
            return(builder);
        }
예제 #3
0
        public static INeoMonitorModuleBuilder AddOtherModules(this INeoMonitorModuleBuilder builder, IConfiguration config)
        {
            var services = builder.Services;

            services
            .AddNeoCommonModule(config.GetSection("CommonModuleSettings"))
            .AddNeoAnalysisWebModule(dbContextOptionsAction: options =>
            {
                options.UseMySql(config.GetConnectionString("AnalysisDevConnection"));
            });
            return(builder);
        }