views:

33

answers:

2

Does nHibernate create code that has all the details of the column?

I know with regular ado.net it increases performance if you have your sql paramters with the column details like: column name, size, sqltype.

A: 

I have not done an in-depth analysis of the code but, yes, it appears that it does. For example, the SqlClientDriver implements methods like:

public static void SetParameterSizes(IDataParameterCollection parameters, SqlType[] parameterTypes)
private static void SetDefaultParameterSize(IDbDataParameter dbParam, SqlType sqlType)
private static void SetVariableLengthParameterSize(IDbDataParameter dbParam, SqlType sqlType)
public override IDbCommand GenerateCommand(CommandType type, SqlString sqlString, SqlType[] parameterTypes)
{
    IDbCommand command = base.GenerateCommand(type, sqlString, parameterTypes);
    if (IsPrepareSqlEnabled)
    {
        SetParameterSizes(command.Parameters, parameterTypes);
    }
    return command;
}

The source code is available if you actually need to check into this.

Stuart Childs
A: 

Why not answer the question yourself and use a Driver that logs and forwards all SQL being spat out by Hibernate.

mP