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


source to share





All Articles