62,074
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="MyBookShop.Model.Book, MyBookShop.Model" table="Books">
<id name="Id" type="Int32" unsaved-value="null">
<column name="Id" length="4" sql-type="int" not-null="true" unique="true" index="PK_Book"/>
<generator class="native" />
</id>
<property name="Title" type="String">
<column name="Title" length="200" sql-type="nvarchar" not-null="true"/>
</property>
<property name="Author" type="String">
<column name="Author" length="200" sql-type="nvarchar" not-null="true"/>
</property>
<property name="PublishDate" type="DateTime">
<column name="PublishDate" length="8" sql-type="datetime" not-null="true"/>
</property>
<property name="ISBN" type="String">
<column name="ISBN" length="50" sql-type="nvarchar" not-null="true" unique="true" index="IX_Books_ISBN"/>
</property>
<property name="WordsCount" type="Int32">
<column name="WordsCount" length="4" sql-type="int" not-null="true"/>
</property>
<property name="UnitPrice" type="Decimal">
<column name="UnitPrice" length="8" sql-type="money" not-null="true"/>
</property>
<property name="ContentDescription" type="String">
<column name="ContentDescription" sql-type="nvarchar" not-null="false"/>
</property>
<property name="AurhorDescription" type="String">
<column name="AurhorDescription" sql-type="nvarchar" not-null="false"/>
</property>
<property name="EditorComment" type="String">
<column name="EditorComment" sql-type="nvarchar" not-null="false"/>
</property>
<property name="TOC" type="String">
<column name="TOC" sql-type="nvarchar" not-null="false"/>
</property>
<property name="Clicks" type="Int32">
<column name="Clicks" length="4" sql-type="int" not-null="true"/>
</property>
<many-to-one name="Category" class="MyBookShop.Model.Category, MyBookShop.Model" foreign-key="FK_Book_Category">
<column name="CategoryId" length="4" sql-type="int" not-null="true"/>
</many-to-one>
<many-to-one name="Publisher" class="MyBookShop.Model.Publisher, MyBookShop.Model" foreign-key="FK_Books_Publishers">
<column name="PublisherId" length="4" sql-type="int" not-null="true"/>
</many-to-one>
<bag name="BookReaderCommentses" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="BookId"/>
<one-to-many class="MyBookShop.Model.ReaderComment, MyBookShop.Model"/>
</bag>
</class>
</hibernate-mapping>
using System;
using System.Collections.Generic;
using System.Text;
namespace MyBookShop.Model
{
[Serializable()]
public class Book
{
#region 字段
private int id;
private string title;
private string author;
private Publisher publisher;
private DateTime publishDate;
private string iSBN;
private int wordsCount;
private int unitPrice;
private string contentDescription;
private string aurhorDescription;
private string editorComment;
private string tOC;
private Category category;
private int clicks;
private List<ReaderComment> bookReaderCommentses = null;
#endregion
#region 属性
public virtual List<ReaderComment> BookReaderCommentses
{
get { return bookReaderCommentses; }
set { bookReaderCommentses = value; }
}
public virtual string ContentDescription
{
get { return contentDescription; }
set { contentDescription = value; }
}
public virtual DateTime PublishDate
{
get { return publishDate; }
set { publishDate = value; }
}
public virtual int Clicks
{
get { return clicks; }
set { clicks = value; }
}
public virtual Category Category
{
get { return category; }
set { category = value; }
}
public virtual string TOC
{
get { return tOC; }
set { tOC = value; }
}
public virtual string EditorComment
{
get { return editorComment; }
set { editorComment = value; }
}
public virtual string AurhorDescription
{
get { return aurhorDescription; }
set { aurhorDescription = value; }
}
public virtual int UnitPrice
{
get { return unitPrice; }
set { unitPrice = value; }
}
public virtual int WordsCount
{
get { return wordsCount; }
set { wordsCount = value; }
}
public virtual string ISBN
{
get { return iSBN; }
set { iSBN = value; }
}
public virtual Publisher Publisher
{
get { return publisher; }
set { publisher = value; }
}
public virtual string Author
{
get { return author; }
set { author = value; }
}
public virtual string Title
{
get { return title; }
set { title = value; }
}
public virtual int Id
{
get { return id; }
set { id = value; }
}
#endregion
}
}