using System.Linq; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.Application; using Volo.Abp.BackgroundWorkers; using System.Threading.Tasks; using Volo.Abp; using System.Reflection; using JiShe.CollectBus.FreeSql; using System; using Volo.Abp.AspNetCore.Mvc.AntiForgery; using JiShe.CollectBus.FreeRedisProvider; using JiShe.CollectBus.Workers; using Volo.Abp.BackgroundWorkers.Hangfire; using JiShe.CollectBus.MongoDB; namespace JiShe.CollectBus; [DependsOn( typeof(CollectBusDomainModule), typeof(CollectBusApplicationContractsModule), typeof(AbpDddApplicationModule), typeof(AbpAutoMapperModule), typeof(AbpBackgroundWorkersHangfireModule), typeof(CollectBusMongoDbModule), typeof(CollectBusFreeRedisModule), typeof(CollectBusFreeSqlModule) )] public class CollectBusApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddMaps(validate: true); }); Configure(options => { options.TokenCookie.Expiration = TimeSpan.FromDays(365); options.AutoValidateIgnoredHttpMethods.Add("POST"); }); } public override void OnApplicationInitialization( ApplicationInitializationContext context) { var assembly = Assembly.GetExecutingAssembly(); var types = assembly.GetTypes().Where(t => typeof(ICollectWorker).IsAssignableFrom(t) && !t.IsInterface).ToList(); foreach (var type in types) { context.AddBackgroundWorkerAsync(type); } } }