I need to limit some function regarding license . so i created an attribute using MethodInterceptionAspect in postSharp and validate the fields i need. is there any other 3rd party making aop custom attributes ? i know dynamic proxy is exist but i want the annotation part also.
Example :
namespace ConsoleApp1
{
[Serializable]
public class LicenseValidator : MethodInterceptionAspect
{
readonly String name;
public LicenseValidator(String name)
{
this.name = name;
}
public override void OnInvoke(MethodInterceptionArgs args)
{
if (name = ! "notInvoke")
{
args.Proceed();
}
else
Console.WriteLine("Not executed !");
}
}
}
And the usage of this :
[LicenseValidator("tal")]
public static Boolean PrintHi(int num)
{
Console.WriteLine("Hi");
return true;
}
NOTE : it's just an example for the usage and isn't my code. but this is the method i want to use in order to solve my problem.
Any other way to achieve it with attributes? 3rd party or manually.
Thanks !