Files

26 lines
639 B
C#
Raw Permalink Normal View History

2026-09-02 16:31:50 +08:00
using Rougamo;
using Rougamo.Context;
using System.Threading;
namespace JSMachine.WMS.Infrastructure.Attributes
{
/// <summary>
/// 注意,任何使用该标记的项目中均需要安装Rougamo.Fody包,否则属性标记锁将失效
/// </summary>
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();
}
}
}