如标题,我解决的方法用了下面的第三种方法.
下面的文章转载于http://hi.baidu.com/zsea/blog/item/7d999e3d8a54c203baa1678d.html
一、Test.Model.Person.hbm.xml(2,2): XML validation error: 未能找到元素“urn:nhibernate-mapping-2.0:hibernate-mapping”的架构信息。
将2.0改为2.2
二、 The following types may not be used as proxies:
Test.Model.Person: method set_Id should be virtual
Test.Model.Person: method get_Name should be virtual
Test.Model.Person: method set_Name should be virtual
Test.Model.Person: method get_Id should be virtual
类配置文件中Class的Lazy改为false
网上搜到的三种解决方案:
1. You can follow the advice of the exception and add "virtual" to all of your properties, and make sure your class is non-sealed. Obviously you'll want to do this if you think you might want to take advantage of the lazy-initializing proxy feature. However, changing your classes may not be practical or advisable if you have a legacy codebase, or it may just bother you that a "transparent" persistence framework is dictating how you design certain aspects of your value classes. That's where Options 2 and 3 come in. Both of those involve changing back to the old behavior.
name="NorthwindClasses.Category, NorthwindClasses"
table="Categories"
lazy="false"
>