与NHibernate和iSeries DB2问题 [英] problem with NHibernate and iSeries DB2

查看:193
本文介绍了与NHibernate和iSeries DB2问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

行,所以我有一个AS400 / i系列上运行V5R4。我有一个是用经典的NHibernate的连接,并做一些基本的CRUD的应用程序。现在,我已经退出该应用程序(这坐了2年)关闭TFS的架子到一个新的PC似乎并不能得到它运行。

Ok So I have an AS400/iSeries running v5r4. I have an application that was using classic NHibernate to connect and do some basic crud. Now I have pulled that app (which sat for 2 years) off the shelf of TFS and onto a new PC and cannot seem to get it running.

下面是我的Hibernate的配置:

Here is my Hibernate Config:

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="connection.provider">
        NHibernate.Connection.DriverConnectionProvider
      </property>
      <property name="dialect">
        NHibernate.Dialect.DB2400Dialect
      </property>
      <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
      <property name="connection.connection_string">
        DataSource=207.206.106.19;
        Database=AS400;
        userID=XXXXXX;
        Password=XXXXXXX;
        LibraryList=FMSFILTST,BEFFILT,HRDBFT,HRCSTFT,J20##X2DEV,GLCUSTDEV,OSL@@F3DEV;
        Naming=System;
        Initial Catalog=*SYSBAS;
      </property>
      <property name="use_outer_join">true</property>
      <property name="query.substitutions">
        true 1, false 0, yes 'Y', no 'N'
      </property>
      <property name="show_sql">false</property>
      <mapping assembly="BusinessLogic" />
    </session-factory>
  </hibernate-configuration>

我拥有所有正确的DLL的包括(NHibernate的,城堡,Iesi填入,antlr3,LOG4等)。也有这条线在我的web.config

I have all the proper DLL's included (NHibernate, castle, iesi, antlr3 , log4 etc). Also have this line in my web.config

<runtime>
    <assemblyBinding>
      <qualifyAssembly partialName="IBM.Data.DB2.iSeries" fullName="IBM.Data.DB2.iSeries,Version=10.0.0.0,PublicKeyToken=9CDB2EBFB1F93A26,Culture=neutral"/>
    </assemblyBinding>
  </runtime>

不过我还是当我打电话收到以下错误

Yet I am still getting the following error as soon as I call

NHibernate.Cfg.Configuration().Configure().BuildSessionFactory().OpenSession();

错误如下:

无法投类型的对象
  IBM.Data.DB2.iSeries.iDB2Connection
  键入System.Data.Common.DbCommand

Unable to cast object of type 'IBM.Data.DB2.iSeries.iDB2Connection' to type 'System.Data.Common.DbCommand'

我渴望得到一些帮助与此有关。任何援助AP preciated。谢谢!

I am dying to get some help with this. Any assistance is appreciated. Thanks!

推荐答案

我使用V5R4的iSeries系统访问时,有这个问题。该IBM.Data.DB2.iSeries.dll是V6R1前针对.NET 1.0 / 1编译。因此它无法在IDB2Connection投来的IDbConnection。如果你使用反射,并期待到IBM的dll,看看下引用,然后看看System.Data这版本。然后看看你在你的项目中引用对System.Data的版本,我猜你是在2.0.5 *的 * 的。如果升级到V6R1或更高,你应该能够施展。

I had this issue when using V5r4 of the iSeries system access. The IBM.Data.DB2.iSeries.dll is compiled against .NET 1.0/1 before v6r1. Because of this it is unable to cast the IDB2Connection to IDbConnection. If you use reflector and look into the IBM dll, look under references and then look at System.Data version. Then look at the version of System.Data you are referencing in your project, I am guessing you are on 2.0.5**. If you upgrade to v6r1 or higher you should be able to cast.

编辑:想给史蒂夫·波伦信贷带领我沿着小路发现这一点。

Wanted to give Steve Bohlen credit for leading me down the path to discover this.

这篇关于与NHibernate和iSeries DB2问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆