Migrating NHibernate 3.3 to 5, getting Method not found: System.Data.IDbCommand NHibernate.AdoNet.AbstractBatcher.get_CurrentCommand() with SqlAzure

坚强是说给别人听的谎言 提交于 2020-01-06 03:49:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!