问题
I am busy migrating a project from NHibernate 3.3.3.4 to 5.1.3. I have picked up an error when committing a transaction or flushing the session.
The error I am currently receiving is as follows:
Method not found: 'System.Data.IDbCommand NHibernate.AdoNet.AbstractBatcher.get_CurrentCommand()'.
I have looked into the NHibernate 5.1.3 code and release notes and I can see that there has been a change to the CurrentCommand property getter for the AbstractBacther class. In this major release of NHibernate, this property has changed from being of type IDbCommand to type DbCommand. See the difference below:
Version 3.3.x Permalink
protected IDbCommand CurrentCommand
{
get { return _batchCommand; }
}
Version 5.1.3 Permalink
protected DbCommand CurrentCommand
{
get { return _batchCommand; }
}
I am using the SqlAzureClientDriver (NHibernate.SqlAzure) for reliable SQL Azure connections. I have noticed that the latest version of NHibernate.SqlAzure is still using the IDbCommand implementation.
Has anybody else using SqlAzureClientDriver experienced this problem and been able to resolve it?
回答1:
Use the NHibernate5 version of SqlAzureClientDriver which can be installed as the nuget package NHibernate5.SqlAzure.
来源:https://stackoverflow.com/questions/53467505/migrating-nhibernate-3-3-to-5-getting-method-not-found-system-data-idbcommand