整了半天没有明白怎么回事,在网上找了半天,有一个朋友给出了答案:
什 么东西嘛真是,MySql.Data.dll添加引用了也没用,又磨了一阵子,才知道要么改系统变量$path,要么把那个dll拷到bin下面,也就是 跟NHibernate.dll在一起,这家伙才能找到MySqlDataDriver。这样,操作数据库的细节就交给了NHibernate,所有建立 映射的数据表内容被映射成类实体列表,通过一个实现了NHibernate.ISession的实体来操作了。
没想到是这个原因,汗了一下。
这样就可以了吧,结果还是有问题,又一个异常:
NHibernate.HibernateException: Could not create the driver from NHibernate.Drive
r.MySqlDataDriver. ---> System.Reflection.TargetInvocationException: Exception h
as been thrown by the target of an invocation. ---> NHibernate.HibernateExceptio
n: The IDbCommand and IDbConnection implementation in the assembly MySql.Data co
uld not be found. Please ensure that the assembly MySql.Data is in the Global A
ssembly Cache or in a location that NHibernate can use System.Type.GetType(strin
g) to load the types from.
NHibernate.HibernateException: Could not create the driver from NHibernate.Drive
r.MySqlDataDriver. ---> System.Reflection.TargetInvocationException: Exception h
as been thrown by the target of an invocation. ---> NHibernate.HibernateExceptio
n: The IDbCommand and IDbConnection implementation in the assembly MySql.Data co
uld not be found. Please ensure that the assembly MySql.Data is in the Global A
ssembly Cache or in a location that NHibernate can use System.Type.GetType(strin
g) to load the types from.
什 么东西嘛真是,MySql.Data.dll添加引用了也没用,又磨了一阵子,才知道要么改系统变量$path,要么把那个dll拷到bin下面,也就是 跟NHibernate.dll在一起,这家伙才能找到MySqlDataDriver。这样,操作数据库的细节就交给了NHibernate,所有建立 映射的数据表内容被映射成类实体列表,通过一个实现了NHibernate.ISession的实体来操作了。
没想到是这个原因,汗了一下。