Skip to content

NH-2952 - Setting the SqlCheck is not supported in the ByCode mapping #869

Closed
@nhibernate-bot

Description

@nhibernate-bot

József Kanczler created an issue — 25th November 2011, 11:53:48:

The ByCode mapping doesn't support to set the SqlCheck setting for the custom sql commands.

The solution for the problem:

1.) I implemented a SqlCheck enumeration with 'None', 'Rowcount', 'Param' values (NHibernate.Mapping.ByCode.SqlCheck).

2.) The IEntitySqlsMapper interface was extended by the overloads for the SqlInsert, SqlUpdate and SqlDelete method.

For example:
void SqlInsert(string sql, SqlCheck sqlCheck);

3.) I implement the new methods for the the classes that implements the IEntitySqlsMapper.

For example:


        public void SqlInsert(string sql, SqlCheck sqlCheck)
        {
            if (classMapping.SqlInsert == null)
            {
                classMapping.sqlinsert = new HbmCustomSQL();
            }
            classMapping.sqlinsert.checkSpecified = true;
            classMapping.sqlinsert.check = (HbmCustomSQLCheck)Enum.Parse(typeof(HbmCustomSQLCheck), sqlCheck.ToString(), true);
            classMapping.sqlinsert.Text = new[] { sql };
        }

or


        public void SqlInsert(string sql, SqlCheck sqlCheck)
        {
            CustomizersHolder.AddCustomizer(typeof(TEntity), (IClassMapper m) => m.SqlInsert(sql, sqlCheck));
        }


Julian Maughan added a comment — 26th November 2011, 7:47:27:

Could you also provide tests?


József Kanczler added a comment — 29th November 2011, 14:24:32:

Do you have any good test framework that can use by code mapping and stored procedures? Because in the nhibernates-test-core I couldn't find anything like that. Or do you accept any kind of unit test for it?


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions