/// <summary> /// Retrieves AOP-augmented proxy, with specified set of aspects attached, for any given object referenced by instance /// parameter. /// </summary> /// <typeparam name="TInstance"></typeparam> /// <param name="instance"></param> /// <param name="aspects"></param> /// <returns></returns> public static InstanceProxy <TInstance> GetProxy <TInstance>(this TInstance instance, IEnumerable <Aspect> aspects = null) where TInstance : class { var proxy = new InstanceProxy <TInstance>(instance, aspects); return(proxy); }
/// <summary> /// Returns AOP-enabled service interface previously registered using SvcLocator.Register(). /// </summary> /// <typeparam name="TInterface">An interface type.</typeparam> /// <param name="aspects"></param> /// <returns>AOP proxy representing service interface.</returns> public static InstanceProxy <TInterface> GetService <TInterface>(IEnumerable <Aspect> aspects = null) where TInterface : class { InstanceProxy <TInterface> proxy = new InstanceProxy <TInterface>(SvcLocator.Get <TInterface>(), aspects); return(proxy); }