I'm building a custom CodeAccessSecurityAttribute to handle authorization for my WCF services. I built class A as such:
public class A : CodeAccessSecurityAttribute
{
public A() : base(SecurityAction.Demand)
{
// Constructor Code
}
public override IPermission CreatePermission()
{
// Permission Creation Code
}
}
And on compilation it produces this error.
Error emitting 'A' attribute -- 'Serialized security custom attribute is
truncated or incorrectly formed.'
After playing with it a little I came up with the next sample that does compile without error:
public class B : CodeAccessSecurityAttribute
{
public B(SecurityAction Action) : base(Action)
{
// Constructor Code
}
public override IPermission CreatePermission()
{
// Permission Creation Code
}
}
I know it's because the SecurityAction enum isn't directly referenced to public side of Class A, but what I can't figure out is how to make it so that I can do it the Class A method instead of the Class B.