本文整理汇总了C#中IInvocationInfo.Proceed方法的典型用法代码示例。如果您正苦于以下问题:C# IInvocationInfo.Proceed方法的具体用法?C# IInvocationInfo.Proceed怎么用?C# IInvocationInfo.Proceed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInvocationInfo
的用法示例。
在下文中一共展示了IInvocationInfo.Proceed方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invoke
public object Invoke(IInvocationInfo invocationInfo)
{
if (session.InTransaction)
{
return invocationInfo.Proceed();
}
using (var transaction = session.Connection.BeginTransaction())
{
session.InTransaction = true;
try
{
var result = invocationInfo.Proceed();
transaction.Commit();
return result;
}
catch (Exception)
{
transaction.Rollback();
throw;
}
finally
{
session.InTransaction = false;
}
}
}
示例2: Invoke
public object Invoke(IInvocationInfo invocation)
{
var method = invocation.Proxy.Target.GetType().GetMethod(invocation.Method.Name);
var joinPoint = new JoinPoint
{
Arguments = invocation.Arguments,
MethodInfo = method,
ReturnValue = null,
TargetObject = invocation.Proxy.Target,
TargetType = invocation.Proxy.Target.GetType(),
ExecuteMethodFromProxy = (() =>
{
var value = invocation.Proceed();
return value;
}),
};
var typesToApply = _types.Where(x => _pointCut.CanApply(joinPoint, x)).ToArray();
if (typesToApply.Length > 0)
{
var aspectsToApply = typesToApply.Select(x => _container.GetInstance(x) as IAspect).ToArray();
aspectsToApply = aspectsToApply.OrderBy(x => x.GetOrder(joinPoint)).ToArray();
var root = aspectsToApply[0];
var aspect = root;
for (var i = 1; i < aspectsToApply.Length; i++)
{
aspect.NextAspect = aspectsToApply[i];
aspect = aspect.NextAspect;
}
root.Apply(joinPoint);
return joinPoint.ReturnValue;
}
else
{
return invocation.Proceed();
}
}
示例3: Invoke
public object Invoke(IInvocationInfo invocationInfo)
{
//If there is a running transaction, just run the method
if (NhUnitOfWork.Current != null)
{
return invocationInfo.Proceed();
}
object returnValue;
try
{
NhUnitOfWork.Current = new NhUnitOfWork(sessionFactory);
NhUnitOfWork.Current.BeginTransaction();
try
{
returnValue = invocationInfo.Proceed();
NhUnitOfWork.Current.Commit();
}
catch (Exception)
{
try
{
NhUnitOfWork.Current.Rollback();
}
catch (Exception)
{
}
throw;
}
}
finally
{
NhUnitOfWork.Current = null;
}
return returnValue;
}
示例4: Invoke
public object Invoke(IInvocationInfo invocationInfo)
{
try
{
// Perform logic before invoking the target method
var returnValue = invocationInfo.Proceed();
// Perform logic after invoking the target method
return returnValue;
}
catch (Exception ex)
{
LogExceptionInformation(invocationInfo, ex);
throw;
}
}
示例5: Invoke
/// <summary>
/// Invoked when a method call is intercepted.
/// </summary>
/// <param name="invocationInfo">The <see cref="IInvocationInfo"/> instance that
/// contains information about the current method call.</param>
/// <returns>The return value from the method.</returns>
public object Invoke(IInvocationInfo invocationInfo)
{
serviceContainer.EndCurrentScope();
return invocationInfo.Proceed();
}
示例6: Invoke
public object Invoke(IInvocationInfo invocationInfo)
{
var args = string.Join(", ", invocationInfo.Arguments.Select(x => (x ?? string.Empty).ToString()));
Debug.WriteLine("LightInject: {0}({1})", invocationInfo.Method, args);
return invocationInfo.Proceed();
}
示例7: Invoke
public object Invoke(IInvocationInfo invocationInfo)
{
return invocationInfo.Proceed();
}
示例8: Invoke
public object Invoke(IInvocationInfo invocationInfo)
{
Bar.ToString();
return invocationInfo.Proceed();
}