Skip to content

IdentitySelectString implementation is inconsistent #1635

Closed
@breglerj

Description

@breglerj

From NHibernate.Dialect.Dialect:

/// <summary> 
/// Get the select command to use to retrieve the last generated IDENTITY
/// value for a particular table 
/// </summary>
/// <param name="tableName">The table into which the insert was done </param>
/// <param name="identityColumn">The PK column. </param>
/// <param name="type">The <see cref="DbType"/> type code. </param>
/// <returns> The appropriate select command </returns>
public virtual string GetIdentitySelectString(string identityColumn, string tableName, DbType type)
{
	return IdentitySelectString;
}

From the comments I would expect the first parameter to be the table name. However, the name of the first parameter suggests it should be the column name.

From NHibernate.Persister.Entity.AbstractEntityPersister:

public string IdentitySelectString
{
	get
	{
		if (identitySelectString == null)
			identitySelectString =
				Factory.Dialect.GetIdentitySelectString(GetTableName(0), GetKeyColumns(0)[0], IdentifierType.SqlTypes(Factory)[0].DbType);
		return identitySelectString;
	}
}

Here the table name is passed as the first parameter matching the comment on NHibernate.Dialect.Dialect.GetIdentitySelectString.

From NHibernate.Persister.Collection.AbstractCollectionPersister:

public string IdentitySelectString
{
	get
	{
		if (identitySelectString == null)
		{
			identitySelectString =
				Factory.Dialect.GetIdentitySelectString(IdentifierColumnName, qualifiedTableName,	IdentifierType.SqlTypes(Factory)[0].DbType);
		}
		return identitySelectString;
	}
}

Here the column name is passed as the first parameter matching the parameter naming on NHibernate.Dialect.Dialect.GetIdentitySelectString.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions