From ae923b269155375295d1615fd6bdabd8e5d9c637 Mon Sep 17 00:00:00 2001 From: oneRain Date: Tue, 20 Apr 2021 11:58:41 +0800 Subject: [PATCH] doc: engine --- .../Attributes/LCEngineClassHookAttribute.cs | 4 ++++ .../Attributes/LCEngineFunctionAttribute.cs | 3 +++ .../LCEngineFunctionParamAttribute.cs | 3 +++ .../Attributes/LCEngineRealtimeHookAttribute.cs | 4 ++++ .../Attributes/LCEngineUserHookAttribute.cs | 4 ++++ Engine/Public/LCEngine.cs | 11 +++++++++-- Engine/Public/LCEngineRequestContext.cs | 17 ++++++++++++++--- Storage/Storage/Public/LCCloud.cs | 3 ++- 8 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Engine/Public/Attributes/LCEngineClassHookAttribute.cs b/Engine/Public/Attributes/LCEngineClassHookAttribute.cs index 6fbe6d8..e62aee0 100644 --- a/Engine/Public/Attributes/LCEngineClassHookAttribute.cs +++ b/Engine/Public/Attributes/LCEngineClassHookAttribute.cs @@ -10,6 +10,10 @@ namespace LeanCloud.Engine { AfterDelete } + /// + /// LCEngineClassHookAttribute is an attribute that hooks class in engine. + /// + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class LCEngineClassHookAttribute : Attribute { public string ClassName { get; diff --git a/Engine/Public/Attributes/LCEngineFunctionAttribute.cs b/Engine/Public/Attributes/LCEngineFunctionAttribute.cs index 1f4ddb0..59ce4be 100644 --- a/Engine/Public/Attributes/LCEngineFunctionAttribute.cs +++ b/Engine/Public/Attributes/LCEngineFunctionAttribute.cs @@ -1,6 +1,9 @@ using System; namespace LeanCloud.Engine { + /// + /// LCEngineFunctionAttribute is an attribute of cloud function in engine. + /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class LCEngineFunctionAttribute : Attribute { public string FunctionName { diff --git a/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs b/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs index 157608c..c762380 100644 --- a/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs +++ b/Engine/Public/Attributes/LCEngineFunctionParamAttribute.cs @@ -1,6 +1,9 @@ using System; namespace LeanCloud.Engine { + /// + /// LCEngineFunctionParamAttribute is an attribute of the parameter of cloud function in engine. + /// [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] public class LCEngineFunctionParamAttribute : Attribute { public string ParamName { diff --git a/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs b/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs index 8c23d06..b8ea596 100644 --- a/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs +++ b/Engine/Public/Attributes/LCEngineRealtimeHookAttribute.cs @@ -20,6 +20,10 @@ namespace LeanCloud.Engine { ClientOffline, } + /// + /// LCEngineRealtimeHookAttribute is an attribute that hooks realtime in engine. + /// + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class LCEngineRealtimeHookAttribute : Attribute { public LCEngineRealtimeHookType HookType { get; diff --git a/Engine/Public/Attributes/LCEngineUserHookAttribute.cs b/Engine/Public/Attributes/LCEngineUserHookAttribute.cs index c9485f1..bf5e25d 100644 --- a/Engine/Public/Attributes/LCEngineUserHookAttribute.cs +++ b/Engine/Public/Attributes/LCEngineUserHookAttribute.cs @@ -7,6 +7,10 @@ namespace LeanCloud.Engine { OnLogin } + /// + /// LCEngineUserHookAttribute is an attribute that hooks user in engine. + /// + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] public class LCEngineUserHookAttribute : Attribute { public LCEngineUserHookType HookType { get; diff --git a/Engine/Public/LCEngine.cs b/Engine/Public/LCEngine.cs index a71368e..0a7bc4d 100644 --- a/Engine/Public/LCEngine.cs +++ b/Engine/Public/LCEngine.cs @@ -11,6 +11,9 @@ using Microsoft.Extensions.DependencyInjection; using LeanCloud.Common; namespace LeanCloud.Engine { + /// + /// LCEngine provides the initialization of Engine in LeanCloud. + /// public class LCEngine { public const string LCEngineCORS = "LCEngineCORS"; @@ -79,6 +82,10 @@ namespace LeanCloud.Engine { public static Dictionary ClassHooks = new Dictionary(); public static Dictionary UserHooks = new Dictionary(); + /// + /// Initializes the engine with the given services. + /// + /// public static void Initialize(IServiceCollection services) { // 获取环境变量 LCLogger.Debug("-------------------------------------------------"); @@ -198,7 +205,7 @@ namespace LeanCloud.Engine { }); } - public static void PrintEnvironmentVar(string key) { + private static void PrintEnvironmentVar(string key) { LCLogger.Debug($"{key} : {Environment.GetEnvironmentVariable(key)}"); } @@ -293,7 +300,7 @@ namespace LeanCloud.Engine { } } - public static object GetFunctions(HttpRequest request) { + internal static object GetFunctions(HttpRequest request) { CheckMasterKey(request); List functions = new List(); diff --git a/Engine/Public/LCEngineRequestContext.cs b/Engine/Public/LCEngineRequestContext.cs index c04c2f9..68e9e2f 100644 --- a/Engine/Public/LCEngineRequestContext.cs +++ b/Engine/Public/LCEngineRequestContext.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading; using LeanCloud.Storage; namespace LeanCloud.Engine { + /// + /// LCEngineRequestContext provides the context of engine request. + /// public class LCEngineRequestContext { public const string RemoteAddressKey = "__remoteAddressKey"; public const string SessionTokenKey = "__sessionToken"; @@ -31,7 +33,10 @@ namespace LeanCloud.Engine { } return requestContext.Value[key]; } - + + /// + /// The remote address of this request. + /// public static string RemoteAddress { get { object remoteAddress = Get(RemoteAddressKey); @@ -45,6 +50,9 @@ namespace LeanCloud.Engine { } } + /// + /// The session token of this request. + /// public static string SessionToken { get { object sessionToken = Get(SessionTokenKey); @@ -58,6 +66,9 @@ namespace LeanCloud.Engine { } } + /// + /// The user of this request. + /// public static LCUser CurrentUser { get { object currentUser = Get(CurrentUserKey); diff --git a/Storage/Storage/Public/LCCloud.cs b/Storage/Storage/Public/LCCloud.cs index a5dcb01..91d671e 100644 --- a/Storage/Storage/Public/LCCloud.cs +++ b/Storage/Storage/Public/LCCloud.cs @@ -6,7 +6,8 @@ using LeanCloud.Storage.Internal.Object; namespace LeanCloud.Storage { /// - /// LeanEngine + /// LCCloud contains static functions that call the cloud functions of Engine + /// in LeanCloud. /// public static class LCCloud { private const string PRODUCTION_KEY = "X-LC-Prod";