csharp-sdk-upm/Engine/Public/Attributes/LCEngineClassHookAttribute.cs

35 lines
919 B
C#
Raw Normal View History

2021-03-18 13:52:23 +08:00
using System;
namespace LeanCloud.Engine {
public enum LCEngineObjectHookType {
BeforeSave,
AfterSave,
BeforeUpdate,
AfterUpdate,
BeforeDelete,
AfterDelete
}
2021-04-20 11:58:41 +08:00
/// <summary>
/// LCEngineClassHookAttribute is an attribute that hooks class in LeanEngine.
2021-04-20 11:58:41 +08:00
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
2021-03-19 11:18:46 +08:00
public class LCEngineClassHookAttribute : Attribute {
2021-03-18 13:52:23 +08:00
public string ClassName {
get;
}
public LCEngineObjectHookType HookType {
get;
}
2021-03-19 11:18:46 +08:00
public LCEngineClassHookAttribute(string className, LCEngineObjectHookType hookType) {
2021-03-25 10:46:03 +08:00
if (string.IsNullOrEmpty(className)) {
throw new ArgumentNullException(nameof(className));
}
2021-03-18 13:52:23 +08:00
ClassName = className;
HookType = hookType;
}
}
}