From 5fe187cfe276d82a7b95035236efdd88eb8283e6 Mon Sep 17 00:00:00 2001 From: zwl Date: Fri, 13 Oct 2023 14:57:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=B3=A8=E5=85=A5=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NewLife.Cube/CubeService.cs | 6 ++++++ NewLife.CubeNC/CubeService.cs | 4 ++++ 2 files changed, 10 insertions(+) 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();