public override bool AddCondition(SqlString condition)
        {
            //TODO: this seems hackish
            var trimCondition = condition.Trim().ToString();

            if (trimCondition.Length > 0 &&
                afterFrom.ToString().IndexOf(trimCondition, StringComparison.Ordinal) < 0 &&
                afterWhere.ToString().IndexOf(trimCondition, StringComparison.Ordinal) < 0)
            {
                if (!condition.StartsWithCaseInsensitive(" and "))
                {
                    afterWhere.Add(" and ");
                }

                afterWhere.Add(condition);
                return(true);
            }

            return(false);
        }
		/// <summary>
		/// Configures the TableGenerator by reading the value of <c>table</c>, 
		/// <c>column</c>, and <c>schema</c> from the <c>parms</c> parameter.
		/// </summary>
		/// <param name="type">The <see cref="IType"/> the identifier should be.</param>
		/// <param name="parms">An <see cref="IDictionary"/> of Param values that are keyed by parameter name.</param>
		/// <param name="dialect">The <see cref="Dialect"/> to help with Configuration.</param>
		public virtual void Configure(IType type, IDictionary<string, string> parms, Dialect.Dialect dialect)
		{
			tableName = PropertiesHelper.GetString(TableParamName, parms, DefaultTableName);
			columnName = PropertiesHelper.GetString(ColumnParamName, parms, DefaultColumnName);
			whereClause = PropertiesHelper.GetString(Where, parms, "");
			string schemaName = PropertiesHelper.GetString(PersistentIdGeneratorParmsNames.Schema, parms, null);
			string catalogName = PropertiesHelper.GetString(PersistentIdGeneratorParmsNames.Catalog, parms, null);

			if (tableName.IndexOf('.') < 0)
			{
				tableName = dialect.Qualify(catalogName, schemaName, tableName);
			}

			var selectBuilder = new SqlStringBuilder(100);
			selectBuilder.Add("select " + columnName)
				.Add(" from " + dialect.AppendLockHint(LockMode.Upgrade, tableName));
			if (string.IsNullOrEmpty(whereClause) == false)
			{
				selectBuilder.Add(" where ").Add(whereClause);
			}
			selectBuilder.Add(dialect.ForUpdateString);

			query = selectBuilder.ToString();

			columnType = type as PrimitiveType;
			if (columnType == null)
			{
				log.Error("Column type for TableGenerator is not a value type");
				throw new ArgumentException("type is not a ValueTypeType", "type");
			}

			// build the sql string for the Update since it uses parameters
			if (type is Int16Type)
			{
				columnSqlType = SqlTypeFactory.Int16;
			}
			else if (type is Int64Type)
			{
				columnSqlType = SqlTypeFactory.Int64;
			}
			else
			{
				columnSqlType = SqlTypeFactory.Int32;
			}

			parameterTypes = new[] {columnSqlType, columnSqlType};

			var builder = new SqlStringBuilder(100);
			builder.Add("update " + tableName + " set ")
				.Add(columnName).Add(" = ").Add(Parameter.Placeholder)
				.Add(" where ")
				.Add(columnName).Add(" = ").Add(Parameter.Placeholder);
			if (string.IsNullOrEmpty(whereClause) == false)
			{
				builder.Add(" and ").Add(whereClause);
			}

			updateSql = builder.ToSqlString();
		}