From: <fab...@us...> - 2009-07-14 17:37:08
|
Revision: 4619 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4619&view=rev Author: fabiomaulo Date: 2009-07-14 17:37:07 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Removed obsolete sections Modified Paths: -------------- branches/2.1.x/nhibernate/doc/reference/master.xml Removed Paths: ------------- branches/2.1.x/nhibernate/doc/reference/modules/nhibernate_tool_hbm2net.xml branches/2.1.x/nhibernate/doc/reference/modules/nullables.xml Modified: branches/2.1.x/nhibernate/doc/reference/master.xml =================================================================== --- branches/2.1.x/nhibernate/doc/reference/master.xml 2009-07-14 17:32:28 UTC (rev 4618) +++ branches/2.1.x/nhibernate/doc/reference/master.xml 2009-07-14 17:37:07 UTC (rev 4619) @@ -82,8 +82,6 @@ &nhc-preface; &nhcaches-chapter; &nhma-chapter; - &nhbm2net-chapter; - &nullables-chapter; </part> </book> Deleted: branches/2.1.x/nhibernate/doc/reference/modules/nhibernate_tool_hbm2net.xml =================================================================== --- branches/2.1.x/nhibernate/doc/reference/modules/nhibernate_tool_hbm2net.xml 2009-07-14 17:32:28 UTC (rev 4618) +++ branches/2.1.x/nhibernate/doc/reference/modules/nhibernate_tool_hbm2net.xml 2009-07-14 17:37:07 UTC (rev 4619) @@ -1,45 +0,0 @@ -<!-- <!DOCTYPE chapter SYSTEM "../docbook-xml/docbookx.dtd"> --> -<chapter id="tool-hbm2net"> - <title>NHibernate.Tool.hbm2net</title> - - - <abstract id="NHibernate.Tool.hbm2net-abstract"> - <title>What is NHibernate.Tool.hbm2net?</title> - <formalpara> - <title>NHibernate.Tool.hbm2net is an add-in for <ulink url="http://www.nhibernate.org">NHibernate</ulink></title> - <para>It makes it possible to generate source files from hbm.xml mapping files.</para> - </formalpara> - <para>In the directory <filename>NHibernate.Tasks</filename>, there is a tool called <command>Hbm2NetTask</command> that you can use to automate your build process (using NAnt)</para> - </abstract> - -<!-- - - <section id="NHibernate.Tool.hbm2net-howto"> - <title>How to use it?</title> - <para>!</para> - </section> - - - <section id="NHibernate.Tool.hbm2net-tips"> - <title>Tips</title> - <itemizedlist> - <listitem><para>!</para></listitem> - </itemizedlist> - </section> - - - <section id="NHibernate.Tool.hbm2net-todo"> - <title>Know issues and TODOs</title> - <para>Read TODOs in the source code ;)</para> - <para>!</para> - </section> - - - <section id="NHibernate.Tool.hbm2net-devnotes"> - <title>Developer Notes</title> - <para>!</para> - </section> - ---> - -</chapter> Deleted: branches/2.1.x/nhibernate/doc/reference/modules/nullables.xml =================================================================== --- branches/2.1.x/nhibernate/doc/reference/modules/nullables.xml 2009-07-14 17:32:28 UTC (rev 4618) +++ branches/2.1.x/nhibernate/doc/reference/modules/nullables.xml 2009-07-14 17:37:07 UTC (rev 4619) @@ -1,110 +0,0 @@ -<!-- <!DOCTYPE chapter SYSTEM "../docbook-xml/docbookx.dtd"> --> -<chapter id="nullables"> - <title>Nullables</title> - - - <abstract id="Nullables-abstract"> - <title>What is Nullables?</title> - <formalpara> - <title>Nullables is an add-in for <ulink url="http://www.nhibernate.org">NHibernate</ulink> contributed by Donald L Mull Jr. (aka <emphasis>luggage</emphasis>)</title> - <para>Most database systems allow base types (like <classname>int</classname> or <classname>bool</classname>) to be null. This means that a boolean column can take the values <emphasis>0</emphasis>, <emphasis>1</emphasis> or <emphasis>null</emphasis>, where <emphasis>null</emphasis> doesn't have the same meaning as <emphasis>0</emphasis>. But it is not possible with .NET 1.x; a bool is always either true or false.</para> - </formalpara> - <para>Nullables makes it possible to use nullable base types in NHibernate. Note that .NET 2.0 has this feature.</para> - </abstract> - - - <section id="Nullables-howto"> - <title>How to use it?</title> - <para>Here is a simple example that uses a <classname>Nullables.NullableDateTime</classname> to (optionally) store the date of birth for a <classname>Person</classname>.</para> - <programlisting> -public <emphasis role="strong">class Person</emphasis> -{ - int _id; - string _name; - <emphasis role="strong">Nullables.NullableDateTime</emphasis> _dateOfBirth; - - public Person() - { - } - - public int Id - { - get { return this._id; } - } - - public string Name - { - get { return this._name; } - set { this._name = value; } - } - - public <emphasis role="strong">Nullables.NullableDateTime</emphasis> DateOfBirth - { - get { return this._dateOfBirth; } - set { this._dateOfBirth = value; } - } -}</programlisting> - <para>As you can see, <emphasis>DateOfBirth</emphasis> has the type <classname>Nullables.NullableDateTime</classname> (instead of <classname>System.DateTime</classname>).</para> - - <para>Here is the mapping</para> - <programlisting><![CDATA[ -<?xml version="1.0" encoding="utf-8" ?> -<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> - <class name="Example.Person, Example" table="Person"> - <id name="Id" access="field.camelcase-underscore" unsaved-value="0"> - <generator class="native" /> - </id> - <property name="Name" type="String" length="200" /> - <]]>property name="<emphasis>DateOfBirth</emphasis>" type="<emphasis role="strong">Nullables.NHibernate.NullableDateTimeType</emphasis>, Nullables.NHibernate"<![CDATA[ /> - </class> -</hibernate-mapping>]]></programlisting> - <important> - <para>In the mapping, the type of <emphasis>DateOfBirth</emphasis> - <emphasis role="strong">must</emphasis> be <classname>Nullables.NHibernate.NullableDateTimeType</classname>. Note that <link linkend="mapping-attributes">NHibernate.Mapping.Attributes</link> handles that automatically.</para> - <para><classname>Nullables.NHibernate.NullableXXXType</classname>s are wrapper types used to translate Nullables types to Database types.</para> - </important> - - <para>Here is a piece of code using this example:</para> - <programlisting> -Person per = new Person(); - -textBox1.Text = per.DateOfBirth.Value.ToString() // will throw an exception when there is no value. - -textBox1.Text = per.DateOfBirth.ToString() // will work. it will return an empty string if there is no value. - -textBox1.Text = (per.DateOfBirth.HasValue ? per.DateOfBirth.Value.ToShortDateString() : "Unknown") // friendly message - -per.DateOfBirth = new System.DateTime(1979, 11, 8); // implicit cast from the "plain" System.DateTime. -per.DateOfBirth = new NullableDateTime(new System.DateTime(1979, 11, 8)); // the long way. - -per.DateOfBirth = null; // this works. -per.DateOfBirth = NullableDateTime.Default; // this is more correct.</programlisting> - </section> - - - <!-- - - <section id="Nullables-tips"> - <title>Tips</title> - <itemizedlist> - <listitem><para>!</para></listitem> - </itemizedlist> - </section> - - - <section id="Nullables-todo"> - <title>Know issues and TODOs</title> - <para>Read TODOs in the source code ;)</para> - <para>!</para> - </section> - - - <section id="Nullables-devnotes"> - <title>Developer Notes</title> - <para>!</para> - </section> - ---> - - -</chapter> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |