private ResolvedBinding ProcessBinding(DothtmlBindingNode node, DataContextStack context) { var value = node.Value; var bindingOptions = controlResolver.ResolveBinding(node.Name); Expression expression = null; Exception parsingError = null; try { expression = bindingParser.Parse(value, context, bindingOptions); } catch (Exception exception) { parsingError = exception; } return(new ResolvedBinding() { BindingType = bindingOptions.BindingType, Value = node.Value, Expression = expression, DataContextTypeStack = context, ParsingError = parsingError, BindingNode = node }); }
protected override IAbstractBinding CompileBinding(DothtmlBindingNode node, BindingParserOptions bindingOptions, IDataContextStack context, IPropertyDescriptor property) { if (context == null) { node.AddError("The DataContext couldn't be evaluated because of the errors above."); } return(treeBuilder.BuildBinding(bindingOptions, context, node, property)); }
/// <summary> /// Processes the binding node. /// </summary> public IAbstractBinding ProcessBinding(DothtmlBindingNode node, IDataContextStack context, IPropertyDescriptor property) { var bindingOptions = controlResolver.ResolveBinding(node.Name); if (bindingOptions == null) { node.NameNode.AddError($"Binding {node.Name} could not be resolved."); bindingOptions = controlResolver.ResolveBinding("value"); // just try it as with value binding } if (context != null && context.NamespaceImports.Count > 0) { bindingOptions = bindingOptions.AddImports(context.NamespaceImports); } return(CompileBinding(node, bindingOptions, context, property)); }
protected override IAbstractBinding CompileBinding(DothtmlBindingNode node, BindingParserOptions bindingOptions, IDataContextStack context) { Expression expression = null; Exception parsingError = null; ITypeDescriptor resultType = null; if (context == null) { parsingError = new DotvvmCompilationException("The DataContext couldn't be evaluated because of the errors above.", node.Tokens); } else { try { expression = bindingExpressionBuilder.Parse(node.Value, (DataContextStack)context, bindingOptions); resultType = new ResolvedTypeDescriptor(expression.Type); } catch (Exception exception) { parsingError = exception; } } return(treeBuilder.BuildBinding(bindingOptions, context, node, resultType, parsingError, expression)); }
/// <summary> /// Compiles the binding. /// </summary> protected abstract IAbstractBinding CompileBinding(DothtmlBindingNode node, BindingParserOptions bindingOptions, IDataContextStack context, IPropertyDescriptor property);
public IAbstractBinding BuildBinding(BindingParserOptions bindingOptions, IDataContextStack dataContext, DothtmlBindingNode node, IPropertyDescriptor property) { return(new ResolvedBinding(bindingService, bindingOptions, (DataContextStack)dataContext, node.Value, property: property as DotvvmProperty) { DothtmlNode = node, }); }
/// <summary> /// Compiles the binding. /// </summary> protected abstract IAbstractBinding CompileBinding(DothtmlBindingNode node, BindingParserOptions bindingOptions, IDataContextStack context);
public void Visit(DothtmlBindingNode binding) { ResolveFromParent(binding); }
public IAbstractBinding BuildBinding(BindingParserOptions bindingOptions, IDataContextStack dataContext, DothtmlBindingNode node, ITypeDescriptor resultType = null, Exception parsingError = null, object customData = null) { return(new ResolvedBinding() { BindingType = bindingOptions.BindingType, Value = node.Value, Expression = (Expression)customData, DataContextTypeStack = (DataContextStack)dataContext, ParsingError = parsingError, DothtmlNode = node, ResultType = resultType }); }