diff --git a/NewLife.Cube/CubeService.cs b/NewLife.Cube/CubeService.cs index 2bc3f121..fe84c01d 100644 --- a/NewLife.Cube/CubeService.cs +++ b/NewLife.Cube/CubeService.cs @@ -6,6 +6,8 @@ using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.WebEncoders; using Microsoft.Net.Http.Headers; +using NewLife.Caching.Services; +using NewLife.Caching; using NewLife.Common; using NewLife.Cube.Modules; using NewLife.Cube.Services; @@ -17,6 +19,7 @@ using Stardust; using Stardust.Registry; using XCode.DataAccessLayer; +using Microsoft.Extensions.DependencyInjection.Extensions; namespace NewLife.Cube; @@ -114,6 +117,9 @@ public static IServiceCollection AddCube(this IServiceCollection services) options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); }); + //默认注入缓存实现 + services.TryAddSingleton(); + // UI服务 services.AddSingleton(); services.AddSingleton(); diff --git a/NewLife.CubeNC/CubeService.cs b/NewLife.CubeNC/CubeService.cs index 26d91a5d..e9b2e6ce 100644 --- a/NewLife.CubeNC/CubeService.cs +++ b/NewLife.CubeNC/CubeService.cs @@ -5,8 +5,10 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Razor; +using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.WebEncoders; using Microsoft.Net.Http.Headers; +using NewLife.Caching; using NewLife.Common; using NewLife.Cube.Extensions; using NewLife.Cube.Modules; @@ -161,6 +163,8 @@ public static IServiceCollection AddCube(this IServiceCollection services) // 支持中文编码 options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); }); + //默认注入缓存实现 + services.TryAddSingleton(); // UI服务 services.AddSingleton();