/// <summary> /// 注册Caching相关处理服务 /// </summary> /// <param name="builder"></param> protected virtual void AddCachingServices(Action <IServiceCollection> action = null) { action?.Invoke(Services); if (this.IsEnableSkyApm()) { SkyApm.AddCaching(); } Services.AddAdncInfraCaching(RedisSection); var serviceType = typeof(ICachePreheatable); var implTypes = ApplicationLayerAssembly.ExportedTypes.Where(type => type.IsAssignableTo(serviceType) && type.IsNotAbstractClass(true)).ToList(); if (implTypes.IsNotNullOrEmpty()) { implTypes.ForEach(implType => { Services.AddSingleton(implType, implType); Services.AddSingleton(x => x.GetRequiredService(implType) as ICachePreheatable); }); } }