private QueryParameter NewParameter(string stringValue, DbType type, string alias)
        {
            if (alias != null)
            {
                const string aliasPattern = "^[a-zA-Z0-9_]*$";
                var          regex        = new Regex(aliasPattern);
                if (!regex.IsMatch(alias))
                {
                    alias = null;
                }
            }

            var result = new QueryParameter()
            {
                ID          = GetNewID(),
                Alias       = alias,
                DataType    = type,
                StringValue = ToStringHelper.ValueString(stringValue, type),
                Value       = Parse(stringValue, type)
            };


            result.ParameterName = string.Format("@p{0}{1}{2}",
                                                 result.ID,
                                                 result.Alias != null ? "_" : null,
                                                 result.Alias
                                                 );

            _parameters.Add(result);

            return(result);
        }
        public string Parameterize(string stringValue, DbType type, string alias = null)
        {
            var matchOn = ToStringHelper.ValueString(stringValue, type);
            var match   = FindMatch(matchOn, type, alias);

            if (match != null)
            {
                return(match.ParameterName);
            }

            var newParameter = NewParameter(stringValue, type, alias);

            return(newParameter.ParameterName);
        }