public bool CanRead(IEvaluationContext context, object target, string name) { var serviceType = ServiceFactoryResolver.GetServiceNameAndType(context, name, out var lookupName); if (serviceType != null) { return(target is IServiceExpressionContext context1 && context1.ContainsService(lookupName, serviceType)); } return(target is IServiceExpressionContext context2 && context2.ContainsService(name)); }
public ITypedValue Read(IEvaluationContext context, object target, string name) { if (target is not IServiceExpressionContext targetContext) { throw new InvalidOperationException("target must be of type IServiceExpressionContext"); } var serviceType = ServiceFactoryResolver.GetServiceNameAndType(context, name, out var lookupName); if (serviceType != null) { return(new TypedValue(targetContext.GetService(lookupName, serviceType))); } return(new TypedValue(targetContext.GetService(name))); }