Difference between revisions of "NHibernate"
(Created page with "== many to many mapping == <source lang="xml"> <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Conso...") |
(→many to many mapping) |
||
Line 1: | Line 1: | ||
+ | |||
+ | == Konfigurationsdatei Sample == | ||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0" encoding="utf-8" ?> | ||
+ | <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> | ||
+ | <session-factory> | ||
+ | <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> | ||
+ | <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property> | ||
+ | <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> | ||
+ | <property name="connection.connection_string">Server=(local);Database=nhibernate;Trusted_Connection=true;</property> | ||
+ | <property name="show_sql">true</property> | ||
+ | </session-factory> | ||
+ | </hibernate-configuration> | ||
+ | </source> | ||
+ | |||
== many to many mapping == | == many to many mapping == | ||
<source lang="xml"> | <source lang="xml"> |
Revision as of 14:32, 11 November 2012
Konfigurationsdatei Sample
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=(local);Database=nhibernate;Trusted_Connection=true;</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
many to many mapping
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="ConsoleApplication2"
namespace="ConsoleApplication2">
<class name="MyItem">
<id name="ID" generator="native"/>
<property name="Name" />
<!-- Many-to-many mapping: OrderItems -->
<bag name="Tags"
table="MyItem_MyTag"
cascade="none"
lazy="true">
<key column ="MyItemID" />
<many-to-many class="MyTag" column="MyTagID" />
</bag>
</class>
</hibernate-mapping>