/// <summary>
        /// Apply inline paremeterMap
        /// </summary>
        /// <param name="statement"></param>
        /// <param name="sqlStatement"></param>
        private void ApplyInlineParemeterMap( IStatement statement, string sqlStatement)
        {
            string newSql = sqlStatement;

            _configScope.ErrorContext.MoreInfo = "apply inline parameterMap";

            // Check the inline parameter
            if (statement.ParameterMap == null)
            {
                // Build a Parametermap with the inline parameters.
                // if they exist. Then delete inline infos from sqltext.

                SqlText sqlText = _paramParser.ParseInlineParameterMap(_configScope,  statement, newSql );

                if (sqlText.Parameters.Length > 0)
                {
                    ParameterMap map = new ParameterMap(_configScope.DataExchangeFactory);
                    map.Id = statement.Id + "-InLineParameterMap";
                    if (statement.ParameterClass!=null)
                    {
                        map.Class = statement.ParameterClass;
                    }
                    map.Initialize(_configScope.DataSource.DbProvider.UsePositionalParameters,_configScope);
                    if (statement.ParameterClass==null &&
                        sqlText.Parameters.Length==1 && sqlText.Parameters[0].PropertyName=="value")//#value# parameter with no parameterClass attribut
                    {
                        map.DataExchange = _configScope.DataExchangeFactory.GetDataExchangeForClass( typeof(int) );//Get the primitiveDataExchange
                    }
                    statement.ParameterMap = map;

                    int lenght = sqlText.Parameters.Length;
                    for(int index=0;index<lenght;index++)
                    {
                        map.AddParameterProperty( sqlText.Parameters[index] );
                    }
                }
                newSql = sqlText.Text;
            }

            ISql sql = null;

            newSql = newSql.Trim();

            if (SimpleDynamicSql.IsSimpleDynamicSql(newSql))
            {
                sql = new SimpleDynamicSql(_configScope, newSql, statement);
            }
            else
            {
                if (statement is Procedure)
                {
                    sql = new ProcedureSql(_configScope, newSql, statement);
                    // Could not call BuildPreparedStatement for procedure because when NUnit Test
                    // the database is not here (but in theory procedure must be prepared like statement)
                    // It's even better as we can then switch DataSource.
                }
                else if (statement is Statement)
                {
                    sql = new StaticSql(_configScope, statement);
                    ISqlMapSession session = new SqlMapSession(_configScope.SqlMapper);

                    ((StaticSql)sql).BuildPreparedStatement( session, newSql );
                }
            }
            statement.Sql = sql;
        }
        /// <summary>
        /// Generate the command text for CRUD operation
        /// </summary>
        /// <param name="configScope"></param>
        /// <param name="statement"></param>
        private void GenerateCommandText(ConfigurationScope configScope, IStatement statement)
        {
            string generatedSQL;

            //------ Build SQL CommandText
            generatedSQL = SqlGenerator.BuildQuery(statement);

            ISql sql = new StaticSql(configScope, statement);
            ISqlMapSession session = new SqlMapSession(configScope.SqlMapper);

            ((StaticSql)sql).BuildPreparedStatement( session, generatedSQL );
            statement.Sql = sql;
        }