public override void Accept(ICommandContext ctx)
        {
            Object value = ctx.GetArg(_names[0]);
            Type   type  = (value != null ? value.GetType() : null);
            InternalValueAndType valueAndType = new InternalValueAndType();

            valueAndType.TargetValue = value;
            valueAndType.TargetType  = type;
            SetupValueAndType(valueAndType);

            if (_blockNullParameter && valueAndType.TargetValue == null)
            {
                ThrowBindOrEmbeddedParameterNullValueException(valueAndType);
            }
            if (!IsInScope())
            {
                // Main Root
                // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                // [UnderReview]: Should I make an original exception instead of this exception?
                // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                // if (valueAndType.TargetValue != null && valueAndType.TargetValue.ToString().IndexOf("?") > -1) {
                //     throw new org.seasar.framework.exception.SRuntimeException("EDAO0023");
                // }
                ctx.AddSql(valueAndType.TargetValue.ToString());
            }
            else
            {
                if (IsInScope() && typeof(System.Collections.IList).IsAssignableFrom(valueAndType.TargetType))
                {
                    System.Collections.IList list = valueAndType.TargetValue as System.Collections.IList;
                    Array array = new Object[list.Count];
                    list.CopyTo(array, 0);
                    EmbedArray(ctx, array);
                }
                else if (IsInScope() && valueAndType.TargetType.IsArray)
                {
                    EmbedArray(ctx, valueAndType.TargetValue);
                }
                else
                {
                    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    // [UnderReview]: Should I make an original exception instead of this exception?
                    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    // if (valueAndType.TargetValue != null && valueAndType.TargetValue.ToString().IndexOf("?") > -1) {
                    //     throw new org.seasar.framework.exception.SRuntimeException("EDAO0023");
                    // }
                    ctx.AddSql(valueAndType.TargetValue.ToString());
                }
            }
            if (valueAndType.IsValidRearOption())
            {
                ctx.AddSql(valueAndType.BuildRearOptionOnSql());
            }
        }
        public override void Accept(ICommandContext ctx)
        {
            object value = ctx.GetArg(_names[0]);
            Type   type  = (value != null ? value.GetType() : null);
            InternalValueAndType valueAndType = new InternalValueAndType();

            valueAndType.TargetValue = value;
            valueAndType.TargetType  = type;
            SetupValueAndType(valueAndType);

            if (_blockNullParameter && valueAndType.TargetValue == null)
            {
                ThrowBindOrEmbeddedParameterNullValueException(valueAndType);
            }
            if (!IsInScope())
            {
                // Main Root
                ctx.AddSql(valueAndType.TargetValue, valueAndType.TargetType, _expression.Replace('.', '_'));
            }
            else
            {
                if (typeof(System.Collections.IList).IsAssignableFrom(valueAndType.TargetType))
                {
                    System.Collections.IList list = valueAndType.TargetValue as System.Collections.IList;
                    Array array = new Object[list.Count];
                    list.CopyTo(array, 0);
                    BindArray(ctx, array);
                }
                else if (valueAndType.TargetType.IsArray)
                {
                    BindArray(ctx, valueAndType.TargetValue);
                }
                else
                {
                    ctx.AddSql(valueAndType.TargetValue, valueAndType.TargetType, _expression.Replace('.', '_'));
                }
            }
            if (valueAndType.IsValidRearOption())
            {
                ctx.AddSql(valueAndType.BuildRearOptionOnSql());
            }
        }
        public void SetupValueAndType(InternalValueAndType valueAndType)
        {
            Object value = valueAndType.TargetValue;
            Type   type  = valueAndType.TargetType;

            // LikeSearchOption handling here is for OutsideSql.
            LikeSearchOption likeSearchOption = null;
            String           rearOption       = null;

            for (int pos = 1; pos < _names.Length; ++pos)
            {
                if (value == null)
                {
                    break;
                }
                String currentName = _names[pos];
                if (pos == 1)  // at the First Loop
                {
                    if (HasLikeSearchOption(type, currentName))
                    {
                        likeSearchOption = GetLikeSearchOption(type, currentName, value);
                    }
                }
                if (value is System.Collections.IDictionary)
                {
                    System.Collections.IDictionary map = (System.Collections.IDictionary)value;
                    value = map[currentName];
                    if (IsLastLoop4LikeSearch(pos, likeSearchOption) && IsValidStringValue(value))  // at the Last Loop
                    {
                        value      = likeSearchOption.generateRealValue((String)value);
                        rearOption = likeSearchOption.getRearOption();
                    }
                    type = (value != null ? value.GetType() : type);
                    continue;
                }
                if (value is NgMap)
                {
                    NgMap map = (NgMap)value;
                    value = map.getAsNg(currentName);
                    if (IsLastLoop4LikeSearch(pos, likeSearchOption) && IsValidStringValue(value))  // at the Last Loop
                    {
                        value      = likeSearchOption.generateRealValue((String)value);
                        rearOption = likeSearchOption.getRearOption();
                    }
                    type = (value != null ? value.GetType() : type);
                    continue;
                }
                PropertyInfo pi = type.GetProperty(currentName);
                if (pi != null)
                {
                    value = pi.GetValue(value, null);
                    if (IsLastLoop4LikeSearch(pos, likeSearchOption) && IsValidStringValue(value))  // at the Last Loop
                    {
                        value      = likeSearchOption.generateRealValue((String)value);
                        rearOption = likeSearchOption.getRearOption();
                    }
                    type = (value != null ? value.GetType() : pi.PropertyType);
                    continue;
                }
                if (pos == 1 && typeof(MapParameterBean).IsAssignableFrom(type))
                {
                    MapParameterBean             pmb = (MapParameterBean)value;
                    IDictionary <String, Object> map = pmb.ParameterMap;
                    Object elementValue = (map != null && map.ContainsKey(currentName) ? map[currentName] : null);
                    if (elementValue != null)
                    {
                        value = elementValue;
                        type  = elementValue.GetType();
                        continue;
                    }
                }
                ThrowBindOrEmbeddedCommentNotFoundPropertyException(_expression, type, currentName, _specifiedSql, _bind);
            }
            valueAndType.TargetValue = value;
            valueAndType.TargetType  = type;
            valueAndType.RearOption  = rearOption;
        }
 protected void ThrowBindOrEmbeddedParameterNullValueException(InternalValueAndType valueAndType)
 {
     ParameterCommentExceptionProvider.ThrowBindOrEmbeddedParameterNullValueException(_expression, valueAndType.TargetType, _specifiedSql, false);
 }
        protected void SetupValueAndType(InternalValueAndType valueAndType)
        {
            InternalValueAndTypeSetuper setupper = new InternalValueAndTypeSetuper(_expression, _names, _specifiedSql, false);

            setupper.SetupValueAndType(valueAndType);
        }