FilterAttributeOnInterfaceMethod

目录

1 FilterAttributeOnInterfaceMethod

1.1 OnMethodExecutedAsync

1.2 OnMethodExecuting

1.3 OnMethodExecutingAsync

  1. FilterAttributeOnInterfaceMethod 

using System;

using System.Threading.Tasks;

namespace Flatwhite.Core.Tests.Attributes

{

public class FilterAttributeOnInterfaceMethod : MethodFilterAttribute

{

public override void OnMethodExecuted(MethodExecutedContext methodExecutedContext)

{

methodExecutedContext.InvocationContext[$"{nameof(FilterAttributeOnInterfaceMethod)}.{nameof(OnMethodExecuted)}"] = DateTime.UtcNow;

}

    1. OnMethodExecutedAsync

public override Task OnMethodExecutedAsync(MethodExecutedContext methodExecutedContext)

{

methodExecutedContext.InvocationContext[$"{nameof(FilterAttributeOnInterfaceMethod)}.{nameof(OnMethodExecutedAsync)}"] = DateTime.UtcNow;

return Task.CompletedTask;

}

    1. OnMethodExecuting

public override void OnMethodExecuting(MethodExecutingContext methodExecutingContext)

{

methodExecutingContext.InvocationContext[$"{nameof(FilterAttributeOnInterfaceMethod)}.{nameof(OnMethodExecutedAsync)}"] = DateTime.UtcNow;

}

    1. OnMethodExecutingAsync

public override Task OnMethodExecutingAsync(MethodExecutingContext methodExecutingContext)

{

methodExecutingContext.InvocationContext[$"{nameof(FilterAttributeOnInterfaceMethod)}.{nameof(OnMethodExecutingAsync)}"] = DateTime.UtcNow;

return Task.CompletedTask;

}

}

}

你可能感兴趣的:(Flatwhite,java,前端,服务器)