本文整理汇总了C#中ITarget.ResolveWithin方法的典型用法代码示例。如果您正苦于以下问题:C# ITarget.ResolveWithin方法的具体用法?C# ITarget.ResolveWithin怎么用?C# ITarget.ResolveWithin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITarget
的用法示例。
在下文中一共展示了ITarget.ResolveWithin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
/// <summary>
/// Gets the value to inject into the specified target.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="target">The target.</param>
/// <returns>The value to inject into the specified target.</returns>
public object GetValue(IContext context, ITarget target)
{
Ensure.ArgumentNotNull(context, "context");
Ensure.ArgumentNotNull(target, "target");
var parameter = context.Parameters.OfType<PropertyValue>().Where(p => p.Name == target.Name).SingleOrDefault();
return parameter != null ? parameter.GetValue(context) : target.ResolveWithin(context);
}
示例2: GetValue
/// <summary>
/// Gets the value to inject into the specified target.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="target">The target.</param>
/// <param name="allPropertyValues">all property values of the current request.</param>
/// <returns>The value to inject into the specified target.</returns>
private object GetValue(IContext context, ITarget target, IEnumerable<IPropertyValue> allPropertyValues)
{
Ensure.ArgumentNotNull(context, "context");
Ensure.ArgumentNotNull(target, "target");
var parameter = allPropertyValues.SingleOrDefault(p => p.Name == target.Name);
return parameter != null ? parameter.GetValue(context, target) : target.ResolveWithin(context);
}
示例3: GetValue
/// <summary>
/// Gets the value to inject into the specified target.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="target">The target.</param>
/// <returns>The value to inject into the specified target.</returns>
public object GetValue(IContext context, ITarget target)
{
Ensure.ArgumentNotNull(context, "context");
Ensure.ArgumentNotNull(target, "target");
var parameter = context
.Parameters.OfType<IConstructorArgument>()
.Where(p => p.AppliesToTarget(context, target)).SingleOrDefault();
return parameter != null ? parameter.GetValue(context, target) : target.ResolveWithin(context);
}
示例4: GetValue
/// <summary>
/// Gets the value to inject into the specified target.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="target">The target.</param>
/// <returns>The value to inject into the specified target.</returns>
public object GetValue(IContext context, ITarget target)
{
var parameter = context
.Parameters.OfType<IConstructorArgument>()
.SingleOrDefault(p => p.AppliesToTarget(context, target));
return parameter != null ? parameter.GetValue(context, target) : target.ResolveWithin(context);
}