Here's roughly what I had in mind:
Class which should get the attribute:
// This should be dynamically - if the if block in the ctor of
// AuthorizeAttribute is true here should be
// [MyOwn1] if its false [MyOwn2]
[MyOwn]
public class MyClass
{
// Check
}
Class which should give the attribute:
public class MyOwnAttribute : Attribute
{
public AuthorizeAttribute()
{
if (SomeMethodOfAnotherClassCheck())
{
[MyOwn1];
{
else
}
[MyOwn2];
}
}
}
Now when MyClass asks for the attribute from the MyOwnAttribute class, it should get the correct one depending on the if condition included in the ctor.
I have no idea how to implement this. Can someone help me here please?