using Rougamo; using Rougamo.Context; using System.Threading; namespace JSMachine.WMS.Infrastructure.Attributes { /// /// 注意,任何使用该标记的项目中均需要安装Rougamo.Fody包,否则属性标记锁将失效 /// public class MethodLockedAttribute : MoAttribute { private static readonly SemaphoreSlim SemaphoreSlim = new(1); public override void OnEntry(MethodContext context) { SemaphoreSlim.Wait(); } public override void OnExit(MethodContext context) { SemaphoreSlim.Release(); } } }