chore: rename

oneRain 2021-03-19 11:18:46 +08:00
parent 2dfc2c5d40
commit b634de675c
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ namespace LeanCloud.Engine {
AfterDelete AfterDelete
} }
public class LCEngineObjectHookAttribute : Attribute { public class LCEngineClassHookAttribute : Attribute {
public string ClassName { public string ClassName {
get; get;
} }
@ -19,7 +19,7 @@ namespace LeanCloud.Engine {
get; get;
} }
public LCEngineObjectHookAttribute(string className, LCEngineObjectHookType hookType) { public LCEngineClassHookAttribute(string className, LCEngineObjectHookType hookType) {
ClassName = className; ClassName = className;
HookType = hookType; HookType = hookType;
} }

View File

@ -70,9 +70,9 @@ namespace LeanCloud.Engine {
Assembly assembly = Assembly.GetCallingAssembly(); Assembly assembly = Assembly.GetCallingAssembly();
ClassHooks = assembly.GetTypes() ClassHooks = assembly.GetTypes()
.SelectMany(t => t.GetMethods()) .SelectMany(t => t.GetMethods())
.Where(m => m.GetCustomAttribute<LCEngineObjectHookAttribute>() != null) .Where(m => m.GetCustomAttribute<LCEngineClassHookAttribute>() != null)
.ToDictionary(mi => { .ToDictionary(mi => {
LCEngineObjectHookAttribute attr = mi.GetCustomAttribute<LCEngineObjectHookAttribute>(); LCEngineClassHookAttribute attr = mi.GetCustomAttribute<LCEngineClassHookAttribute>();
switch (attr.HookType) { switch (attr.HookType) {
case LCEngineObjectHookType.BeforeSave: case LCEngineObjectHookType.BeforeSave:
return $"{BeforeSave}{attr.ClassName}"; return $"{BeforeSave}{attr.ClassName}";