-
Notifications
You must be signed in to change notification settings - Fork 24
/
Context.cs
88 lines (73 loc) · 2.55 KB
/
Context.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using Datory;
namespace SiteServer.Plugin
{
/// <summary>
/// 封装系统上下文相关信息
/// </summary>
public static class Context
{
private static IEnvironment _environment;
private static IApiCollection _apiCollection;
/// <summary>
/// 初始化上下文
/// </summary>
/// <param name="environment">环境变量接口。</param>
/// <param name="apiCollection">API类集合接口。</param>
public static void Initialize(IEnvironment environment, IApiCollection apiCollection)
{
if (_environment == null)
{
_environment = environment;
}
if (_apiCollection == null)
{
_apiCollection = apiCollection;
}
}
/// <summary>
/// 系统信息。
/// </summary>
public static IEnvironment Environment => _environment;
public static IAuthenticatedRequest AuthenticatedRequest => UtilsApi.GetAuthenticatedRequest();
/// <summary>
/// 管理员及权限Api接口。
/// </summary>
public static IAdminApi AdminApi => _apiCollection.AdminApi;
/// <summary>
/// 插件及系统配置Api接口。
/// </summary>
public static IConfigApi ConfigApi => _apiCollection.ConfigApi;
/// <summary>
/// 内容Api接口。
/// </summary>
public static IContentApi ContentApi => _apiCollection.ContentApi;
///// <summary>
///// 数据库操作Api接口。
///// </summary>
//public static IDatabaseApi DatabaseApi => _apiCollection.DatabaseApi;
/// <summary>
/// 栏目Api接口。
/// </summary>
public static IChannelApi ChannelApi => _apiCollection.ChannelApi;
/// <summary>
/// STL解析Api接口。
/// </summary>
public static IParseApi ParseApi => _apiCollection.ParseApi;
/// <summary>
/// 插件Api接口。
/// </summary>
public static IPluginApi PluginApi => _apiCollection.PluginApi;
/// <summary>
/// 站点Api接口。
/// </summary>
public static ISiteApi SiteApi => _apiCollection.SiteApi;
/// <summary>
/// 用户Api接口。
/// </summary>
public static IUserApi UserApi => _apiCollection.UserApi;
/// <summary>
/// 工具类Api接口。
/// </summary>
public static IUtilsApi UtilsApi => _apiCollection.UtilsApi;
}
}