| | |
| | | options.WithStackFrame = true; |
| | | }); |
| | | |
| | | services.AddConfigurableOptions<AliyunOptions>(); |
| | | |
| | | services.AddComponent<EventBusServiceComponent>(); |
| | | |
| | | services.AddComponent<DistributedCacheServiceComponent>(); |
| | |
| | | services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblies(App.Assemblies.ToArray())); |
| | | |
| | | services.AddHostedService<XmlDocBuildHostedService>(); |
| | | services.AddHostedService<BuildDynamicControllersHostedService>(); |
| | | |
| | | services.AddJwt<JwtHandler>(enableGlobalAuthorize: true); |
| | | |
| | | services.AddCorsAccessor(); |
| | | |
| | | services.AddSpecificationDocuments(options => |
| | | { |
| | | options.OperationFilter<CustomOperationIdFilter>(); |
| | | options.SchemaFilter<EnumSchemaFilter>(); |
| | | }); |
| | | |
| | | services.AddControllers() |
| | | .AddNewtonsoftJson(options => |
| | | { |
| | | options.SerializerSettings.Converters.Add(new StringEnumConverter()); |
| | | //options.SerializerSettings.Converters.Add(new StringEnumConverter()); |
| | | }) |
| | | .AddFriendlyException() |
| | | .AddDataValidation() |
| | | .AddInjectWithUnifyResult<FriendlyResultProvider>(); |
| | | } |
| | | |
| | | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| | | public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime) |
| | | { |
| | | // 解析事件总线发布服务 |
| | | var eventPublisher = app.ApplicationServices.GetRequiredService<IEventPublisher>(); |
| | |
| | | |
| | | app.UseUnifyResultStatusCodes(); |
| | | |
| | | app.UseHttpsRedirection(); |
| | | //app.UseHttpsRedirection(); |
| | | |
| | | app.UseRouting(); |
| | | |
| | |
| | | |
| | | app.UseInject(string.Empty); |
| | | |
| | | app.UseSpecificationDocuments(); |
| | | |
| | | app.UseEndpoints(endpoints => |
| | | { |
| | | endpoints.MapControllers(); |
| | | }); |
| | | |
| | | //lifetime.ApplicationStarted.Register(async () => |
| | | //{ |
| | | // await ResourceUtils.BuildDynamicControllersAsync(); |
| | | //}); |
| | | } |
| | | } |
| | | } |