Postsharp using common interfaces

Not sure if this is possible, but is there a way to access my generic interface when using LocationInterceptionAspect without using reflection?

I want to pass the current instance of an interface type (which is generic) and execute the methods.

I am trying to accomplish the following, please note on ICachable (which is not valid):

    public override void OnGetValue(LocationInterceptionArgs args)
    {
        var value = args.GetCurrentValue() as ICachable<T>;

        if (value == null)
        {
            throw new Exception(string.Format("Object type: {0} must be of type ICachable", value.GetType()));
        }

        value.Load();
        value.SetCache("COLC");

        args.ProceedGetValue();
    }

      

+3
postsharp


source to share


No one has answered this question yet

Check out similar questions:

7
Applying an Attribute to an Interface with PostSharp
five
PostSharp and uninitialized objects
3
Hijacking PostSharp interface vs DynamicProxy2
2
Postsharp and NLog, general design
1
Postsharp: build failed with issuing license with postsharp version 5.0.26
1
POSTSHARP: disable postharp for debugging, for Onentry and Onexit functions,
1
OnMethodBoundryAspect Walkthrough of Interface Implementation
1
Use PostSharp to create a type
0
Postsharp MethodInterceptionAspect method cannot be applied to interface method
0
Implementing a generic / dynamic interface with PostSharp



All Articles
Loading...
X
Show
Funny
Dev
Pics