ExpressionSubTreeHolder() public method

public ExpressionSubTreeHolder ( ) : HqlExpressionSubTreeHolder
return HqlExpressionSubTreeHolder
Ejemplo n.º 1
0
        private HqlTreeNode BuildFromArray(IEnumerable valueArray, HqlTreeBuilder treeBuilder, Type elementType)
        {
            Type enumUnderlyingType = elementType.IsEnum ? Enum.GetUnderlyingType(elementType) : null;
            IList<HqlTreeNode> variants = new List<HqlTreeNode>();

            foreach (object variant in valueArray)
            {
                object val = variant;

                if (elementType.IsEnum)
                    val = Convert.ChangeType(variant, enumUnderlyingType);

                HqlConstant hqlConstant = treeBuilder.Constant(val);
                variants.Add(hqlConstant);
            }

            return treeBuilder.ExpressionSubTreeHolder(variants);
        }