public virtual void Intercept(IInvocation invocation) { // try to get property info from the current invocation get_ method. var getProperty = invocation.ExtractPropertyInfoByGetMethod(); if (getProperty != null && !_filter.NeverIntercept(getProperty)) { // if property info found var contentData = invocation.Proxy as IContentData; // let's filter out properties from EPiServer library if (contentData != null) { // let's lookup getter var propertyGetter = Registry.LookupGetters(getProperty).FirstOrDefault(x => x.CanIntercept(contentData, getProperty)); if (propertyGetter != null) { // and if getter is present and can intercept the current call let's get the return value from one. invocation.ReturnValue = propertyGetter.GetValue(contentData, getProperty); } } } }
public override void Intercept(IInvocation invocation) { var getProperty = invocation.ExtractPropertyInfoByGetMethod(); if (getProperty != null) { System.Diagnostics.Debug.WriteLine("INTERCEPT: " + getProperty.Name); } var propertiesInterceptor = ServiceLocator.Current.GetInstance<EPiPropertiesInterceptor>(); propertiesInterceptor.Intercept(invocation); if (invocation.ReturnValue == null) { base.Intercept(invocation); } }
public override void Intercept(IInvocation invocation) { var getProperty = invocation.ExtractPropertyInfoByGetMethod(); if (getProperty != null) { System.Diagnostics.Debug.WriteLine("INTERCEPT: " + getProperty.Name); } var propertiesInterceptor = ServiceLocator.Current.GetInstance <EPiPropertiesInterceptor>(); propertiesInterceptor.Intercept(invocation); if (invocation.ReturnValue == null) { base.Intercept(invocation); } }