Created
February 7, 2010 14:04
-
-
Save scottwater/297464 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Post | |
{ | |
public virtual int Id { get; set; } | |
public virtual string Title { get; set; } | |
public virtual string Body { get; set; } | |
public virtual DateTime PubDate { get; set; } | |
public virtual ICollection<Tag> Tags { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" | |
assembly="..." | |
namespace="..."> | |
<class name="Post" table="Posts" > | |
<id name="Id"> | |
<generator class="identity"/> | |
</id> | |
<property name="Title" not-null="true" length="256"/> | |
<property name="Body" not-null="true"/> | |
<property name="PubDate" not-null="true"/> | |
<set name="Tags" table="Tags" inverse="true" cascade="all-delete-orphan"> | |
<key column="PostId" /> | |
<one-to-many class="Tag" /> | |
</set> | |
</class> | |
</hibernate-mapping> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Tag | |
{ | |
public virtual int Id { get; set; } | |
public virtual string Name { get; set; } | |
public virtual Post Parent { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" | |
assembly="..." | |
namespace="..."> | |
<class name="Tag" table="Tags" > | |
<id name="Id"> | |
<generator class="identity"/> | |
</id> | |
<property name="Name" not-null="true" length="64"/> | |
<many-to-one name="Parent" column="PostId" not-null="true"/> | |
<!-- | |
<set name="Posts" table="Posts" > | |
<key column="Id"></key> | |
<many-to-many class="Post" column="Id"></many-to-many> | |
</set> | |
--> | |
</class> | |
</hibernate-mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment