错误如下!!
The following types may not be used as proxies:
Entitys.login: method get_Upwd should be virtual
Entitys.login: method get_id should be virtual
Entitys.login: method get_Uname should be virtual
Entitys.login: method set_Uname should be virtual
Entitys.login: method get_LastTime should be virtual
Entitys.login: method set_Upwd should be virtual
Entitys.login: method set_id should be virtual
Entitys.login: method set_LastTime should be virtual
----------------------------------------------------------------------------
引起问题的原因:
NHibernate 1.2 默认为类启用了延迟加载功能
解决方法:
方法1.在映射文件 class 标签中添加 Lazy="false" 属性
例: lazy="false">
方法2.为每个实体类的属性成员 添加 “ virtual ” 修饰符;
例:
public virtual int id
{
get { return m_id; }
set { m_id = value; }
}
----------------------------------------------------------------------------
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14111848/viewspace-1010938/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14111848/viewspace-1010938/