首页 新闻 会员 周边

NHibernate Configuration ?

0
悬赏园豆:10 [已关闭问题]

代码
namespace NhibernateConsole
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
NHibernate.Cfg.Configuration cfg
= new NHibernate.Cfg.Configuration();
cfg.AddAssembly(
"NhibernateConsole");
ISessionFactory isessionfactory
= cfg.BuildSessionFactory();
ISession isession
= isessionfactory.OpenSession();
ITransaction itransaction
= isession.BeginTransaction();
User user
= new User();
user.Name
= this.name.Text.Trim();
user.Pwd
= this.password.Text.Trim();
try
{
isession.Save(user);
label1.Text
= "Add Successfully";

}
catch(Exception ex)
{
this.label1.Text = ex.Message;
}

}
}
 
 
 
 
The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>

 

 

Dangerious的主页 Dangerious | 初学一级 | 园豆:185
提问于:2010-01-12 14:45
< >
分享
其他回答(1)
0

错误信息告诉你怎么做了:

The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>

 

补充hibernate.cfg.xml文件session-factory configuration节点

李永京 | 园豆:3114 (老鸟四级) | 2010-01-12 16:42
0

http://www.cnblogs.com/virusswb/archive/2010/01/08/1642402.html

Virus-BeautyCode | 园豆:1619 (小虾三级) | 2010-01-12 18:54
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册