本文整理汇总了C#中IInvocation.ExtractPropertyInfoByGetMethod方法的典型用法代码示例。如果您正苦于以下问题:C# IInvocation.ExtractPropertyInfoByGetMethod方法的具体用法?C# IInvocation.ExtractPropertyInfoByGetMethod怎么用?C# IInvocation.ExtractPropertyInfoByGetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInvocation
的用法示例。
在下文中一共展示了IInvocation.ExtractPropertyInfoByGetMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Intercept
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);
}
}
示例2: Intercept
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);
}
}
}
}