コード例 #1
0
ファイル: Startup.cs プロジェクト: zzpgeorge/NanoFabric
        /// This method gets called by the runtime. Use this method to add services to the container.
        /// https://damienbod.com/2018/02/02/securing-an-asp-net-core-mvc-application-which-uses-a-secure-api/
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddNanoFabricConsul(Configuration);
            services.AddNanoFabricConsulRouter();

            //services.AddAuthorization();
            services.AddCors();
            services.AddDistributedMemoryCache();

            services
            .AddApplication <InMemoryRequestManager>(Configuration)
            .AddPermissiveCors()
            .AddCustomIdentity(ApiInfo.Instance)
            .AddCustomSwagger(ApiInfo.Instance);

            //var collectorUrl = Configuration.GetValue<string>("Skywalking:CollectorUrl");
            //services.AddSkyWalking(option =>
            //{
            //    option.DirectServers = collectorUrl;
            //    option.ApplicationCode = "SampleService_Kestrel";
            //});

            services.AddMvc()
            .AddMvcApiResult();
            services.Configure <ForwardedHeadersOptions>(options =>
            {
                options.ForwardedHeaders =
                    ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
            });

            return(services.ConvertToAutofac(
                       MediatrModule.Create(ApiInfo.Instance.ApplicationAssembly)
                       ));
        }
コード例 #2
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddIdentityApplication(_configuration);
            services.AddMvc();
            services.AddFeatureFoldersSupport();

            return(services.ConvertToAutofac(
                       MediatrModule.Create(typeof(Application.Startup).Assembly)
                       ));
        }
コード例 #3
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddIdentityApplication(_configuration);

            services.AddHealthChecks(checks =>
            {
                checks.AddValueTaskCheck("HTTP Endpoint", () => new
                                         ValueTask <IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
            });

            services.AddMvc();
            services.AddFeatureFoldersSupport();

            return(services.ConvertToAutofac(
                       MediatrModule.Create(typeof(Application.Startup).Assembly)
                       ));
        }
コード例 #4
0
ファイル: Startup.cs プロジェクト: nailtonrf/BuildingBlocks
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services
            .AddMvc(options =>
            {
                options.Filters.Add(typeof(HttpGlobalExceptionFilter));
            });

            services
            .AddApplication <InMemoryRequestManager>(Configuration)
            .AddPermissiveCors()
            .AddCustomIdentity(ApiInfo.Instance)
            .AddCustomSwagger(ApiInfo.Instance);

            return(services.ConvertToAutofac(
                       MediatrModule.Create(ApiInfo.Instance.ApplicationAssembly)
                       ));
        }
コード例 #5
0
        public static IServiceProvider AddApplication(
            this IServiceCollection services
            )
        {
            services.AddSingleton <IDocumentStore>((sp) =>
            {
                var store = new DocumentStore
                {
                    Urls     = new[] { "http://localhost:8080" },
                    Database = "Notifications"
                }.Initialize();

                new NotificationsUnprocessed().Execute(store);

                return(store);
            });

            services.AddSingleton <ProcessModelsStoreFactory>();
            services.AddSingleton((sp) =>
            {
                var factory = sp.GetService <ProcessModelsStoreFactory>();
                return(factory.Create());
            });

            services.AddSingleton <ProcessInstancesStoreFactory>();
            services.AddSingleton((sp) =>
            {
                var factory = sp.GetService <ProcessInstancesStoreFactory>();
                return(factory.Create());
            });

            services.AddSingleton <ProcessManager>();

            services.AddSingleton <IRequestManager>(new InMemoryRequestManager());

            return(services.ConvertToAutofac(
                       MediatrModule.Create(typeof(Startup).Assembly)
                       ));
        }