id;
public Int32 Id
{
get { return id; }
set { id = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string email;
public string Email
{
get { return email; }
set { email = value; }
}
}
}
我们再在User.cs目录里添加一个文件User.hbm.xml,文件的生成操作为嵌入的资源
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="SpringHiberate.dao.model.User,SpringHiberate" table="FS_User" lazy="false">
<id name="Id" column="id" type="Int32">
<generator class="native" />
</id>
<property name="Name" column="uname" type="String" length="50" />
<property name="Email" column="uemail" type="String" length="50" />
</class>
</hibernate-mapping>
然后我们写一个SQLProvider类SQLProvider.cs.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Spring.Data.Common;
namespace SpringHiberate.dao
{
public class SQLProvider : IDbProvider
{
#region IDbProvider 成员
private string _c;
public string ConnectionString
{
get
{
return this._connectionString;
}
&nb |