From: <fab...@us...> - 2009-07-14 18:59:33
|
Revision: 4629 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4629&view=rev Author: fabiomaulo Date: 2009-07-14 18:59:32 +0000 (Tue, 14 Jul 2009) Log Message: ----------- Docs typedef Modified Paths: -------------- branches/2.1.x/nhibernate/doc/reference/modules/basic_mapping.xml Modified: branches/2.1.x/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- branches/2.1.x/nhibernate/doc/reference/modules/basic_mapping.xml 2009-07-14 18:51:14 UTC (rev 4628) +++ branches/2.1.x/nhibernate/doc/reference/modules/basic_mapping.xml 2009-07-14 18:59:32 UTC (rev 4629) @@ -2499,8 +2499,25 @@ The <literal>IUserType</literal> can now retrieve the value for the parameter named <literal>default</literal> from the <literal>IDictionary</literal> object passed to it. </para> - <para> + If you use a certain <literal>UserType</literal> very often, it may be useful to define a + shorter name for it. You can do this using the <literal><typedef></literal> element. + Typedefs assign a name to a custom type, and may also contain a list of default + parameter values if the type is parameterized. + </para> + + <programlisting><![CDATA[<typedef class="MyCompany.UserTypes.DefaultValueIntegerType" name="default_zero"> + <param name="default">0</param> +</typedef>]]></programlisting> + + <programlisting><![CDATA[<property name="priority" type="default_zero"/>]]></programlisting> + + <para> + It is also possible to override the parameters supplied in a typedef on a case-by-case basis + by using type parameters on the property mapping. + </para> + + <para> Even though NHibernate's rich range of built-in types and support for components means you will very rarely <emphasis>need</emphasis> to use a custom type, it is nevertheless considered good form to use custom types for (non-entity) classes that occur frequently This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |