NHibernate使用3中框架动态代理方式Nhibernate常见的错误
来源:互联网 发布:南阳理工软件 编辑:程序博客网 时间:2024/06/08 03:29
1.NHibernate使用3中框架动态代理方式
(1).Castle框架
如果使用Castle.DynamicProxy2动态代理,引用NHibernate.ByteCode.Castle.dll程序集并配置proxyfactory.factory_class
<property name="proxyfactory.factory_class"> NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle</property>
(2).LinFu框架
如果使用LinFu.DynamicProxy动态代理,引用NHibernate.ByteCode.LinFu.dll程序集并配置proxyfactory.factory_class节点为
<property name="proxyfactory.factory_class"> NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu</property>
(3).Spring.NET框架
引用NHibernate.ByteCode.Spring.dll程序集并配置proxyfactory.factory_class节点为
<property name="proxyfactory.factory_class"> NHibernate.ByteCode.Spring.ProxyFactoryFactory,NHibernate.ByteCode.Spring</property>
如果配置不正确可能导致异常:
Unable to load type 'NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu' during configuration of proxy factory class.
Possible causes are:
- The NHibernate.Bytecode provider assembly was not deployed.
- The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.
Solution:
Confirm that your deployment folder contains one of the following assemblies:
NHibernate.ByteCode.LinFu.dll
NHibernate.ByteCode.Castle.dll
2.影射文件与数据库的字段配置不一致 异常:异常could not load an entity:.....................................
3.创建SessionFactory工厂时候
private ISessionFactory GetSessionFactory()
{
Configuration confriguration = new Configuration().AddAssembly("DomainModel");
return confriguration.Configure().BuildSessionFactory();//异常:Could not compile the mapping document: DomainModel.Customer.hbm.xml
}
这样是不会抛出异常的:
private ISessionFactory GetSessionFactory()
{
Configuration confriguration = new Configuration().AddAssembly("DomainModel");
return confriguration.BuildSessionFactory();
}
4。影射文件的命名空间
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="DomainModel" namespace="DomainModel" default-lazy="false">
如果不加default-lazy="false"的话有可能抛出异常:“NHibernate.ByteCode.Castle.ProxyFactory”的类型初始值设定项引发异常。
5。至于加不加<mapping assembly="DomainModel"/>这个节点,在笔者的机子上是没有错误的。
- NHibernate使用3中框架动态代理方式Nhibernate常见的错误
- Nhibernate常见的错误
- 错误:NHibernate使用错误
- Nhibernate 开发中遇到过的错误
- NHibernate中使用事务
- 。net中使用NHibernate
- NHibernate 框架
- Nhibernate一个错误的解决
- 在C#中使用NHibernate框架查询数据
- 在C#中使用NHibernate框架查询数据
- 在C#中使用NHibernate框架查询数据
- Nhibernate中使用enum字段
- ASP.NET中使用Nhibernate
- nhibernate使用
- nhibernate使用
- Nhibernate 使用
- 使用nHibernate
- NHibernate
- 配置Struts2 xml Referenced file contains errors (http://struts.apache.org/dtds/struts-2.0.dtd). For m
- zoj 2859 Matrix Searching
- 在shell脚本中调用另一个脚本的三种不同方法(fork, exec, source)
- MiniGUI输入法模块mGi软键盘使用实例
- linux的find、grep用法
- NHibernate使用3中框架动态代理方式Nhibernate常见的错误
- Magento Mgt Developer Toolbar安装详细说明
- 18种常见室内植物的功效
- 导出excel
- RedHat/CentOS系统信息查看命令大全
- Adapter的 cursor注入方式
- 目的
- Android 源码下载中遇到的问题
- linux cat 命令详解