Exemplo n.º 1
0
        public bool Bind(SymbolTable symbolTable)
        {
            if (!ProcessExpression(symbolTable))
            {
                return(false);
            }

            object convertedLiteralValue;

            if (LiteralTypeConverter.TryConvert(BoundProperty.PropertyType, XValue, out convertedLiteralValue))
            {
                PropertyBinder.BindFinalValue(BoundProperty, ParentItem, convertedLiteralValue, XObject, false);
                return(true);
            }

            IFrameworkItem boundItem = ScopedSearch(XValue, symbolTable);

            if (boundItem != null)
            {
                PropertyBinder.BindFinalValue(BoundProperty, ParentItem, boundItem, XObject, false);
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public static bool BindLiteralOrReference(ParserContext context, XObject xmlObject, string xmlValue, PropertyInfo boundProperty)
        {
            object convertedLiteralValue;

            if (LiteralTypeConverter.TryConvert(boundProperty.PropertyType, xmlValue, out convertedLiteralValue))
            {
                if (BindExpression(context, xmlObject, xmlValue, boundProperty))
                {
                    return(true);
                }

                BindFinalValue(boundProperty, context.FrameworkItem, convertedLiteralValue, xmlObject, true);
                return(true);
            }

            if (xmlObject is XAttribute)
            {
                if (BindExpression(context, xmlObject, xmlValue, boundProperty))
                {
                    return(true);
                }

                DelayedBind(context, xmlObject, xmlValue, boundProperty);
                return(true);
            }

            return(false);
        }