From: Michael D. <mik...@us...> - 2004-10-25 05:20:37
|
Update of /cvsroot/nhibernate/nhibernate/doc/reference/en/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8120/modules Modified Files: architecture.xml basic_mapping.xml Log Message: worked on it a little bit more. Index: basic_mapping.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/doc/reference/en/modules/basic_mapping.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** basic_mapping.xml 22 Oct 2004 21:01:56 -0000 1.4 --- basic_mapping.xml 25 Oct 2004 05:20:25 -0000 1.5 *************** *** 1,2 **** --- 1,10 ---- + <!-- + before committing make sure to comment out the DOCTYPE + It is in here to get intellisense with XMLSpy. The + HomeEdition is a free download. + + <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "../../support/docbook-dtd/docbookx.dtd"> + --> <chapter id="mapping"> <title>Basic O/R Mapping</title> *************** *** 90,96 **** </para> ! <programlistingco> ! ! <programlisting> <hibernate-mapping schema="schemaName" <co id="hm1-co" linkends="hm1" /> --- 98,103 ---- </para> ! ! <programlisting> <hibernate-mapping schema="schemaName" <co id="hm1-co" linkends="hm1" /> *************** *** 99,133 **** default-access="property|field|nosetter|ClassName" <co id="hm4-co" linkends="hm4" /> > ! </programlisting> ! <calloutlist> ! <callout arearefs="hm1-co" id="hm1"> ! <para> ! <literal>schema</literal> (optional): The name of a database schema. ! </para> ! </callout> ! <callout arearefs="hm2-co" id="hm2"> ! <para> ! <literal>default-cascade</literal> (optional - defaults to <literal>none</literal>): ! A default cascade style. ! </para> ! </callout> ! <callout arearefs="hm3-co" id="hm3"> ! <para> ! <literal>auto-import</literal> (optional - defaults to <literal>true</literal>): ! Specifies whether we can use unqualified class names (of classes in this mapping) ! in the query language. ! </para> ! </callout> ! <callout arearefs="hm4-co" id="hm4"> ! <para> ! <literal>default-access</literal> (optional - defaults to <literal>property</literal>): ! The strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! ! </calloutlist> ! </programlistingco> <para> --- 106,139 ---- default-access="property|field|nosetter|ClassName" <co id="hm4-co" linkends="hm4" /> > ! </programlisting> ! <calloutlist> ! <callout arearefs="hm1-co" id="hm1"> ! <para> ! <literal>schema</literal> (optional): The name of a database schema. ! </para> ! </callout> ! <callout arearefs="hm2-co" id="hm2"> ! <para> ! <literal>default-cascade</literal> (optional - defaults to <literal>none</literal>): ! A default cascade style. ! </para> ! </callout> ! <callout arearefs="hm3-co" id="hm3"> ! <para> ! <literal>auto-import</literal> (optional - defaults to <literal>true</literal>): ! Specifies whether we can use unqualified class names (of classes in this mapping) ! in the query language. ! </para> ! </callout> ! <callout arearefs="hm4-co" id="hm4"> ! <para> ! <literal>default-access</literal> (optional - defaults to <literal>property</literal>): ! The strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! ! </calloutlist> <para> *************** *** 145,151 **** </para> ! <programlistingco> ! <programlisting><class name="ClassName" <co id="class1-co" linkends="class1" /> table="tableName"<co id="class2-co" linkends="class2" /> --- 151,157 ---- </para> ! ! <programlisting><class name="ClassName" <co id="class1-co" linkends="class1" /> table="tableName"<co id="class2-co" linkends="class2" /> *************** *** 160,233 **** persister="PersisterClass"<co id="class11-co" linkends="class11" /> /></programlisting> ! <calloutlist> ! <callout arearefs="class1-co" id="class1"> ! <para> ! <literal>name</literal>: The fully qualified .NET Type name of the persistent class ! (or interface). ! </para> ! </callout> ! <callout arearefs="class2-co" id="class2"> ! <para> ! <literal>table</literal>: The name of its database table. ! </para> ! </callout> ! <callout arearefs="class3-co" id="class3"> ! <para> ! <literal>discriminator-value</literal> (optional - defaults to the class name): A value ! that distiguishes individual subclasses, used for polymorphic behaviour. ! </para> ! </callout> ! <callout arearefs="class4-co" id="class4"> ! <para> ! <literal>mutable</literal> (optional, defaults to <literal>true</literal>): Specifies ! that instances of the class are (not) mutable. ! </para> ! </callout> ! <callout arearefs="class5-co" id="class5"> ! <para> ! <literal>schema</literal> (optional): Override the schema name specified by ! the root <literal><hibernate-mapping></literal> element. ! </para> ! </callout> ! <callout arearefs="class6-co" id="class6"> ! <para> ! <literal>proxy</literal> (optional): Specifies an interface to use for lazy ! initializing proxies. You may specify the name of the class itself as long as ! all Properties are virtual. ! </para> ! </callout> ! <callout arearefs="class7-co" id="class7"> ! <para> ! <literal>dynamic-update</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>UPDATE</literal> SQL should be generated at runtime and ! contain only those columns whose values have changed. ! </para> ! </callout> ! <callout arearefs="class8-co" id="class8"> ! <para> ! <literal>dynamic-insert</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>INSERT</literal> SQL should be generated at runtime and ! contain only the columns whose values are not null. ! </para> ! </callout> ! <callout arearefs="class9-co" id="class9"> ! <para> ! <literal>polymorphism</literal> (optional, defaults to <literal>implicit</literal>): ! Determines whether implicit or explicit query polymorphism is used. ! </para> ! </callout> ! <callout arearefs="class10-co" id="class10"> ! <para> ! <literal>where</literal> (optional) specify an arbitrary SQL <literal>WHERE</literal> ! condition to be used when retrieving objects of this class ! </para> ! </callout> ! <callout arearefs="class11-co" id="class11"> ! <para> ! <literal>persister</literal> (optional): Specifies a custom <literal>IClassPersister</literal>. ! </para> ! </callout> ! </calloutlist> ! </programlistingco> <para> --- 166,238 ---- persister="PersisterClass"<co id="class11-co" linkends="class11" /> /></programlisting> ! <calloutlist> ! <callout arearefs="class1-co" id="class1"> ! <para> ! <literal>name</literal>: The fully qualified .NET Type name of the persistent class ! (or interface). ! </para> ! </callout> ! <callout arearefs="class2-co" id="class2"> ! <para> ! <literal>table</literal>: The name of its database table. ! </para> ! </callout> ! <callout arearefs="class3-co" id="class3"> ! <para> ! <literal>discriminator-value</literal> (optional - defaults to the class name): A value ! that distiguishes individual subclasses, used for polymorphic behaviour. ! </para> ! </callout> ! <callout arearefs="class4-co" id="class4"> ! <para> ! <literal>mutable</literal> (optional, defaults to <literal>true</literal>): Specifies ! that instances of the class are (not) mutable. ! </para> ! </callout> ! <callout arearefs="class5-co" id="class5"> ! <para> ! <literal>schema</literal> (optional): Override the schema name specified by ! the root <literal><hibernate-mapping></literal> element. ! </para> ! </callout> ! <callout arearefs="class6-co" id="class6"> ! <para> ! <literal>proxy</literal> (optional): Specifies an interface to use for lazy ! initializing proxies. You may specify the name of the class itself as long as ! all Properties are virtual. ! </para> ! </callout> ! <callout arearefs="class7-co" id="class7"> ! <para> ! <literal>dynamic-update</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>UPDATE</literal> SQL should be generated at runtime and ! contain only those columns whose values have changed. ! </para> ! </callout> ! <callout arearefs="class8-co" id="class8"> ! <para> ! <literal>dynamic-insert</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>INSERT</literal> SQL should be generated at runtime and ! contain only the columns whose values are not null. ! </para> ! </callout> ! <callout arearefs="class9-co" id="class9"> ! <para> ! <literal>polymorphism</literal> (optional, defaults to <literal>implicit</literal>): ! Determines whether implicit or explicit query polymorphism is used. ! </para> ! </callout> ! <callout arearefs="class10-co" id="class10"> ! <para> ! <literal>where</literal> (optional) specify an arbitrary SQL <literal>WHERE</literal> ! condition to be used when retrieving objects of this class ! </para> ! </callout> ! <callout arearefs="class11-co" id="class11"> ! <para> ! <literal>persister</literal> (optional): Specifies a custom <literal>IClassPersister</literal>. ! </para> ! </callout> ! </calloutlist> <para> *************** *** 293,298 **** </para> ! <programlistingco> ! <programlisting><id name="propertyName" <co id="id1-co" linkends="id1" /> type="typename" <co id="id2-co" linkends="id2" /> --- 298,302 ---- </para> ! <programlisting><id name="propertyName" <co id="id1-co" linkends="id1" /> type="typename" <co id="id2-co" linkends="id2" /> *************** *** 303,339 **** <generator class="generatorClass"/> </id> </programlisting> ! <calloutlist> ! <callout arearefs="id1-co" id="id1"> ! <para> ! <literal>name</literal> (optional): The name of the identifier property. ! </para> ! </callout> ! <callout arearefs="id2-co" id="id2"> ! <para> ! <literal>type</literal> (optional): A name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="id3-co" id="id3"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): The ! name of the primary key column. ! </para> ! </callout> ! <callout arearefs="id4-co" id="id4"> ! <para> ! <literal>unsaved-value</literal> (optional - defaults to <literal>null</literal>): ! An identifier property value that indicates that an instance is newly instantiated ! (unsaved), distinguishing it from transient instances that were saved or loaded ! in a previous session. ! </para> ! </callout> ! <callout arearefs="id5-co" id="id5"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> ! </programlistingco> <para> --- 307,343 ---- <generator class="generatorClass"/> </id> </programlisting> ! <calloutlist> ! <callout arearefs="id1-co" id="id1"> ! <para> ! <literal>name</literal> (optional): The name of the identifier property. ! </para> ! </callout> ! <callout arearefs="id2-co" id="id2"> ! <para> ! <literal>type</literal> (optional): A name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="id3-co" id="id3"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): The ! name of the primary key column. ! </para> ! </callout> ! <callout arearefs="id4-co" id="id4"> ! <para> ! <literal>unsaved-value</literal> (optional - defaults to <literal>null</literal>): ! An identifier property value that indicates that an instance is newly instantiated ! (unsaved), distinguishing it from transient instances that were saved or loaded ! in a previous session. ! </para> ! </callout> ! <callout arearefs="id5-co" id="id5"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> ! <para> *************** *** 366,371 **** </para> ! <programlistingco> ! <programlisting><property name="propertyName"<co id="property1-co" linkends="property1" /> column="column_name"<co id="property2-co" linkends="property2" /> --- 370,374 ---- </para> ! <programlisting><property name="propertyName"<co id="property1-co" linkends="property1" /> column="column_name"<co id="property2-co" linkends="property2" /> *************** *** 376,427 **** access="field|property|nosetter|ClassName"<co id="property7-co" linkends="property7" /> /></programlisting> ! <calloutlist> ! <callout arearefs="property1-co" id="property1"> ! <para> ! <literal>name</literal>: the name of the property in the same case as the Propery in your API ! </para> ! </callout> ! <callout arearefs="property2-co" id="property2"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): the name ! of the mapped database table column. ! </para> ! </callout> ! <callout arearefs="property3-co" id="property3"> ! <para> ! <literal>type</literal> (optional): a name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="property4-co" id="property4"> ! <para> ! <literal>update</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL <literal>UPDATE</literal> ! </para> ! </callout> ! <callout arearefs="property5-co" id="property5"> ! <para> ! <literal>insert</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL ! <literal>INSERT</literal> statements. Setting both <literal>insert</literal> ! and <literal>update</literal> to <literal>false</literal> ! allows a pure "derived" property whose value is initialized from some other ! property that maps to the same colum(s) or by a trigger or other application. ! </para> ! </callout> ! <callout arearefs="property6-co" id="property6"> ! <para> ! <literal>formula</literal> (optional): an SQL expression that defines the value for a ! <emphasis>computed</emphasis> property. Computed properties do not have a column ! mapping of their own. ! </para> ! </callout> ! <callout arearefs="property7-co" id="property7"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> ! </programlistingco> <para> --- 379,429 ---- access="field|property|nosetter|ClassName"<co id="property7-co" linkends="property7" /> /></programlisting> ! <calloutlist> ! <callout arearefs="property1-co" id="property1"> ! <para> ! <literal>name</literal>: the name of the property in the same case as the Propery in your API ! </para> ! </callout> ! <callout arearefs="property2-co" id="property2"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): the name ! of the mapped database table column. ! </para> ! </callout> ! <callout arearefs="property3-co" id="property3"> ! <para> ! <literal>type</literal> (optional): a name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="property4-co" id="property4"> ! <para> ! <literal>update</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL <literal>UPDATE</literal> ! </para> ! </callout> ! <callout arearefs="property5-co" id="property5"> ! <para> ! <literal>insert</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL ! <literal>INSERT</literal> statements. Setting both <literal>insert</literal> ! and <literal>update</literal> to <literal>false</literal> ! allows a pure "derived" property whose value is initialized from some other ! property that maps to the same colum(s) or by a trigger or other application. ! </para> ! </callout> ! <callout arearefs="property6-co" id="property6"> ! <para> ! <literal>formula</literal> (optional): an SQL expression that defines the value for a ! <emphasis>computed</emphasis> property. Computed properties do not have a column ! mapping of their own. ! </para> ! </callout> ! <callout arearefs="property7-co" id="property7"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> <para> *************** *** 474,564 **** be text formatted as <literal>access-strategy.naming-strategy</literal>. The <literal>.naming-stragey</literal> is not always required. ! <variablelist> <title>Access Strategy</title> ! <varlistentry> ! <term><literal>property</literal></term> ! <listitem> ! <para> ! The default implementation. NHibernate uses the get/set of your Property. No ! Naming Strategy should be used with this Access Strategy because the ! <literal>name</literal> attribute is the name of your Property. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>field</literal></term> ! <listitem> ! <para> ! NHibernate will access the Field directly. NHibernate uses the <literal><name></literal> ! as the name of the field. This can be used when a Property's get and set have extra ! actions in them that you don't want to occur when NHibernate is populating or reading the object. ! If you want the name of the Property and not the Field to be what the consumers of your API ! use with HQL, then a Naming Strategy is needed. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>nosetter</literal></term> ! <listitem> ! <para> ! NHibernate will access the Field directly when setting the value and will use the ! Property when getting the value. This can be used when a Property only exposes a get because ! the consumers of your API can't change the value directly. A Naming Strategy is required ! because NHibernate uses the <literal>name</literal> attribute as the Property so it needs to ! be told what the name of the Field is. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>ClassName</literal></term> ! <listitem> ! <para> ! If NHibernate's built in Access Strategies are not what is needed for your situation ! then you can build your own by implementing the interface ! <literal>NHibernate.Property.IPropertyAccessor</literal>. The value of the ! <literal>access</literal> attribute should be an Assembly Qualified Name that can be ! loaded with <literal>Activator.CreateInstance(string AssemblyQualifiedName)</literal>. ! </para> ! </listitem> ! </varlistentry> ! </variablelist> </para> <para> ! <variablelist> <title>Naming Strategy</title> ! <varlistentry> ! <term><literal>camelcase</literal></term> ! <listitem> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>foo</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>camelcase-underscore</literal></term> ! <listitem> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase and prefixed with an ! underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>_foo</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>pascalcase-m-underscore</literal></term> ! <listitem> ! <para> ! The <literal>name</literal> attribute is prefixed with the character ! m and an underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>m_Foo</literal>. ! </para> ! </listitem> ! </varlistentry> ! </variablelist> </para> </sect2> </sect1> --- 476,860 ---- be text formatted as <literal>access-strategy.naming-strategy</literal>. The <literal>.naming-stragey</literal> is not always required. ! <table> <title>Access Strategy</title> ! <tgroup cols="2"> ! <thead> ! <row> ! <entry>Access Strategy Name</entry> ! <entry>Description</entry> ! </row> ! </thead> ! <tbody> ! <row> ! <entry><literal>property</literal></entry> ! <entry> ! <para> ! NHibernate will access the Field directly. NHibernate uses the <literal><name></literal> ! as the name of the field. This can be used when a Property's get and set have extra ! actions in them that you don't want to occur when NHibernate is populating or reading the object. ! If you want the name of the Property and not the Field to be what the consumers of your API ! use with HQL, then a Naming Strategy is needed. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>field</literal></entry> ! <entry> ! <para> ! NHibernate will access the Field directly. NHibernate uses the <literal><name></literal> ! as the name of the field. This can be used when a Property's get and set have extra ! actions in them that you don't want to occur when NHibernate is populating or reading the object. ! If you want the name of the Property and not the Field to be what the consumers of your API ! use with HQL, then a Naming Strategy is needed. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>nosetter</literal></entry> ! <entry> ! <para> ! NHibernate will access the Field directly when setting the value and will use the ! Property when getting the value. This can be used when a Property only exposes a get because ! the consumers of your API can't change the value directly. A Naming Strategy is required ! because NHibernate uses the <literal>name</literal> attribute as the Property so it needs to ! be told what the name of the Field is. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>ClassName</literal></entry> ! <entry> ! <para> ! If NHibernate's built in Access Strategies are not what is needed for your situation ! then you can build your own by implementing the interface ! <literal>NHibernate.Property.IPropertyAccessor</literal>. The value of the ! <literal>access</literal> attribute should be an Assembly Qualified Name that can be ! loaded with <literal>Activator.CreateInstance(string AssemblyQualifiedName)</literal>. ! </para> ! </entry> ! </row> ! </tbody> ! </tgroup> ! </table> </para> <para> ! <table> <title>Naming Strategy</title> ! <tgroup cols="2"> ! <thead> ! <row> ! <entry>Naming Strategy Name</entry> ! <entry>Description</entry> ! </row> ! </thead> ! <tbody> ! <row> ! <entry><literal>camelcase</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>foo</literal>. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>camelcase-underscore</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase and prefixed with an ! underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>_foo</literal>. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>lowercase-underscore</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is converted to all LowerCase and prefixed with an ! underscore to find the Field. ! <literal><property name="FooBar" ... ></literal> uses the Field <literal>_foobar</literal>. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>pascalcase-m-underscore</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is prefixed with the character ! <literal>m</literal> and an underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>m_Foo</literal>. ! </para> ! </entry> ! </row> ! </tbody> ! </tgroup> ! </table> </para> </sect2> </sect1> + <sect1 id="mapping-types"> + <title>NHibernate Types</title> + <sect2 id="mapping-types-entitiesvalues"> + <title>Entities and values</title> + + <para> + To understand the behaviour of various .NET language-level objects with respect + to the persistence service, we need to classify them into two groups: + </para> + + <para> + An <emphasis>entity</emphasis> exists independently of any other objects holding + references to the entity. Contrast this with the usual .NET model where an + unreferenced object is garbage collected. Entities must be explicitly saved and + deleted (except that saves and deletions may be <emphasis>cascaded</emphasis> + from a parent entity to its children). Entities support + circular and shared references. They may also be versioned. + </para> + + <para> + An entity's persistent state consists of references to other entities and + instances of <emphasis>value</emphasis> types. Values are structs, + collections, components and certain immutable objects. Unlike entities, values + (in particular collections and components) <emphasis>are</emphasis> + persisted and deleted by reachability. Since value objects (and structs) are + persisted and deleted along with their containing entity they may not be + independently versioned. Values have no independent identity, so they cannot be + shared by two entities or collections. + </para> + + <para> + All NHibernate types except collections support null semantics if the .NET type also + supports it. + </para> + + <para> + Up until now, we've been using the term "persistent class" to refer to + entities. We will continue to do that. Strictly speaking, however, not all + user-defined classes with persistent state are entities. A + <emphasis>component</emphasis> is a user defined class with value semantics. + </para> + </sect2> + <sect2 id="mapping-types-basictypes"> + <title>Basic value types</title> + + <para> + The <emphasis>basic types</emphasis> may be roughly categorized into three groups - <literal>System.ValueType</literal> + types, <literal>System.Object</literal> types, and <literal>System.Object</literal> types for large objects. Just like + the .NET Types, columns for System.ValueType types <emphasis>can not</emphasis> store <literal>null</literal> values + and System.Object types <emphasis>can</emphasis> store <literal>null</literal> values. + </para> + <table> + <title>System.ValueType Mapping Types</title> + <tgroup cols="4"> + <thead> + <row> + <entry>NHibernate Type</entry> + <entry>.NET Type</entry> + <entry>Database Type</entry> + <entry>Remarks</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>Boolean</literal></entry> + <entry><literal>System.Boolean</literal></entry> + <entry><literal>DbType.Boolean</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Byte</literal></entry> + <entry><literal>System.Byte</literal></entry> + <entry><literal>DbType.Byte</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Char</literal></entry> + <entry><literal>System.Char</literal></entry> + <entry><literal>DbType.StringFixedLength - 1 char</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>DateTime</literal></entry> + <entry><literal>System.DateTime</literal></entry> + <entry><literal>DbType.DateTime</literal> - ignores the milliseconds</entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Decimal</literal></entry> + <entry><literal>System.Decimal</literal></entry> + <entry><literal>DbType.Decimal</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Double</literal></entry> + <entry><literal>System.Double</literal></entry> + <entry><literal>DbType.Double</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Guid</literal></entry> + <entry><literal>System.Guid</literal></entry> + <entry><literal>DbType.Guid</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Int16</literal></entry> + <entry><literal>System.Int16</literal></entry> + <entry><literal>DbType.Int16</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Int32</literal></entry> + <entry><literal>System.Int32</literal></entry> + <entry><literal>DbType.Int32</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Int64</literal></entry> + <entry><literal>System.Int64</literal></entry> + <entry><literal>DbType.Int64</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>PersistentEnum</literal></entry> + <entry>A <literal>System.Enum</literal></entry> + <entry>The <literal>DbType</literal> for the underlying value.</entry> + <entry>Do not specify <literal>type="PersistentEnum"</literal> in the mapping. Instead + specify the Assembly Qualified Name of the Enum or let NHibernate use Reflection to "guess" the Type. + The UnderlyingType of the Enum is used to determine the correct <literal>DbType</literal>.</entry> + </row> + <row> + <entry><literal>Single</literal></entry> + <entry><literal>System.Single</literal></entry> + <entry><literal>DbType.Single</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Ticks</literal></entry> + <entry><literal>System.DateTime</literal></entry> + <entry><literal>DbType.Int64</literal></entry> + <entry><literal>type="Ticks"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>TimeSpan</literal></entry> + <entry><literal>System.TimeSpan</literal></entry> + <entry><literal>DbType.Int64</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Timestamp</literal></entry> + <entry><literal>System.DateTime</literal></entry> + <entry><literal>DbType.DateTime</literal> - as specific as database supports.</entry> + <entry><literal>type="Timestamp"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>TrueFalse</literal></entry> + <entry><literal>System.Boolean</literal></entry> + <entry><literal>DbType.AnsiStringFixedLength</literal> - 1 char either 'T' or 'F'</entry> + <entry><literal>type="TrueFalse"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>YesNo</literal></entry> + <entry><literal>System.Boolean</literal></entry> + <entry><literal>DbType.AnsiStringFixedLength</literal> - 1 char either 'Y' or 'N'</entry> + <entry><literal>type="YesNo"</literal> must be specified.</entry> + </row> + </tbody> + </tgroup> + </table> + + <table> + <title>System.Object Mapping Types</title> + <tgroup cols="4"> + <thead> + <row> + <entry>NHibernate Type</entry> + <entry>.NET Type</entry> + <entry>Database Type</entry> + <entry>Remarks</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>AnsiString</literal></entry> + <entry><literal>System.String</literal></entry> + <entry><literal>DbType.AnsiString</literal></entry> + <entry><literal>type="AnsiString"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>CultureInfo</literal></entry> + <entry><literal>System.Globalization.CultureInfo</literal></entry> + <entry><literal>DbType.String</literal> - 5 chars for culture</entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Binary</literal></entry> + <entry><literal>System.Byte[]</literal></entry> + <entry><literal>DbType.Binary</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Type</literal></entry> + <entry><literal>System.Type</literal></entry> + <entry><literal>DbType.String</literal> holding Assembly Qualified Name.</entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>String</literal></entry> + <entry><literal>System.String</literal></entry> + <entry><literal>DbType.String</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + </tbody> + </tgroup> + </table> + + <table> + <title>Large Object Mapping Types</title> + <tgroup cols="4"> + <thead> + <row> + <entry>NHibernate Type</entry> + <entry>.NET Type</entry> + <entry>Database Type</entry> + <entry>Remarks</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>StringClob</literal></entry> + <entry><literal>System.String</literal></entry> + <entry><literal>DbType.String</literal></entry> + <entry><literal>type="StringClob"</literal> must be specified. Entire field is read into memory.</entry> + </row> + <row> + <entry><literal>BinaryBlob</literal></entry> + <entry><literal>System.Byte[]</literal></entry> + <entry><literal>DbType.Binary</literal></entry> + <entry><literal>type="BinaryBlob"</literal> must be specified. Entire field is read into memory.</entry> + </row> + <row> + <entry><literal>Serializable</literal></entry> + <entry>Any <literal>System.Object</literal> that is marked with SerializableAttribute.</entry> + <entry><literal>DbType.Binary</literal></entry> + <entry><literal>type="Serializable"</literal> should be specified. This is the fallback type + if no NHibernate Type can be found for the Property.</entry> + </row> + </tbody> + </tgroup> + </table> + + <para> + For those of you coming over from Hibernate or using some of the tools to generate <literal>hbm.xml</literal> files + that are intended for Hibernate, there is a Hibernate compatiblity layer for type names. A <literal>type="integer"</literal> + will map to an <literal>Int32</literal> NHibernateType, <literal>type="short"</literal> to an <literal>Int16</literal> + NHibernateType. To see all of the conversions you can view the source of static constructor of the class + <literal>NHibernate.Type.TypeFactory</literal>. + </para> + </sect2> + + </sect1> *************** *** 583,586 **** </sect1> ! </chapter> ! --- 879,881 ---- </sect1> ! </chapter> \ No newline at end of file Index: architecture.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/doc/reference/en/modules/architecture.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** architecture.xml 21 Oct 2004 13:21:42 -0000 1.3 --- architecture.xml 25 Oct 2004 05:20:08 -0000 1.4 *************** *** 1,2 **** --- 1,10 ---- + <!-- + before committing make sure to comment out the DOCTYPE + It is in here to get intellisense with XMLSpy. The + HomeEdition is a free download. + + <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "../../support/docbook-dtd/docbookx.dtd"> + --> <chapter id="architecture"> *************** *** 64,68 **** Heres some definitions of the objects in the diagrams: ! <variablelist spacing="compact"> <varlistentry> <term>SessionFactory (<literal>NHibernate.ISessionFactory</literal>)</term> --- 72,76 ---- Heres some definitions of the objects in the diagrams: ! <variablelist> <varlistentry> <term>SessionFactory (<literal>NHibernate.ISessionFactory</literal>)</term> |