XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.ServerInteractive

[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.ServerInteractive

修改架构

136c72e
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

3 个文件 +15 -8
Modified XFEExtension.NetCore.ServerInteractive/Implements/CoreService/ServerCoreStandardServiceBase.cs +1 -1
@@ -5,7 +5,7 @@ namespace XFEExtension.NetCore.ServerInteractive.Implements.CoreService;
5 5 /// <summary>
6 6 /// 服务器标准核心服务基类
7 7 /// </summary>
8 public abstract partial class ServerCoreStandardServiceBase : XFEServerCoreServiceBase, IServerCoreStandardService
8 public abstract class ServerCoreStandardServiceBase : XFEServerCoreServiceBase, IServerCoreStandardService, IServerCoreRouteProvider
9 9 {
10 10 /// <summary>
11 11 /// 所有入口点路径列表(由增量生成器自动填充)
Added XFEExtension.NetCore.ServerInteractive/Interfaces/CoreService/IServerCoreRouteProvider.cs +12 -0
@@ -0,0 +1,12 @@
1 namespace XFEExtension.NetCore.ServerInteractive.Interfaces.CoreService;
2
3 /// <summary>
4 /// 提供标准核心服务路由路径列表的静态抽象契约
5 /// </summary>
6 public interface IServerCoreRouteProvider
7 {
8 /// <summary>
9 /// 入口点路径列表
10 /// </summary>
11 static abstract List<string> EntryPointList { get; }
12 }
Modified XFEExtension.NetCore.ServerInteractive/Utilities/Server/XFEServerCoreBuilder.cs +2 -7
@@ -69,14 +69,9 @@ public abstract class XFEServerCoreBuilder : XFEBuilderBase<XFEServerCoreBuilder
69 69 /// </summary>
70 70 /// <typeparam name="T">服务泛型</typeparam>
71 71 /// <returns>XFE服务器核心构建器</returns>
72 public XFEServerCoreBuilder AddService<T>() where T : IServerCoreStandardService, new()
72 public XFEServerCoreBuilder AddService<T>() where T : IServerCoreStandardService, IServerCoreRouteProvider, new()
73 73 {
74 // 从T的静态EntryPointList属性获取所有路由路径
75 var entryPointListProperty = typeof(T).GetProperty("EntryPointList", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.FlattenHierarchy);
76 if (entryPointListProperty is null)
77 throw new InvalidOperationException($"类型 {typeof(T).Name} 没有静态的 EntryPointList 属性");
78
79 var entryPointList = entryPointListProperty.GetValue(null) as List<string>;
74 var entryPointList = T.EntryPointList;
80 75 if (entryPointList is null || entryPointList.Count == 0)
81 76 throw new InvalidOperationException($"类型 {typeof(T).Name} 的 EntryPointList 为空");
82 77