Files
juipnet/Services/Hncore.Pass.OSS/UEditor/UEditorMvcExtension.cs
wanyongkang d318014316 初始提交
2020-10-07 20:25:03 +08:00

32 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Hncore.Pass.Vpn.Service;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace UEditor.Core
{
public static class UEditorMvcExtension
{
/// <summary>
/// 添加UEditor后端服务
/// </summary>
/// <param name="services">IServiceCollection</param>
/// <param name="configFileRelativePath">配置文件相对路径</param>
/// <param name="isCacheConfig">是否缓存配置文件</param>
/// <param name="basePath">配置文件、文件存储路径等各种路径的根目录默认为Web项目的根目录</param>
public static void AddUEditorService(this IServiceCollection services,
string configFileRelativePath = "ueditor.json",
bool isCacheConfig = true,
string basePath = "")
{
Config.ConfigFile = configFileRelativePath;
Config.NoCache = isCacheConfig;
Config.WebRootPath = basePath;
services.AddScoped<UploadService>();
services.TryAddSingleton<UEditorService>();
}
}
}