2009/5/25 Shane C <[email protected]>
>
> What is the negative to setting an unsaved-value?
>
example:The <version> or <timestamp> or <id> has certain default values
depending on the underlining System.Type used.
NH know which is the default value and never use it for persistent stuff; NH
use it only to know if the entity is unsaved.
<version> and <timestamp> should never set by your code so here there is no
problem because the unsaved-value is default(T).
For <id> you can set the value and you can choose your own unsaved-value
but... if the type is an Int32 why you should use -1 as unsaved-value ?
The unsaved-value tag stay there only for legacy DB.
Starting from NH2.0.0 there is a new MAIN RULE writing mappings:
Don't try to be clear because it will be dark
Less you write more clear will be the mapping, less errors you will have in
it, less XML to maintain and, over all, one "eyes shot" to understand both
worlds (your domain and its persistent representation).
<class name="Galeria">
<cache usage="nonstrict-read-write" region="semistatic"/>
<id name="Id" access="backfield">
<generator class="hilo" />
</id>
<property name="Nombre" length="50"/>
<property name="PaisCod"/>
<property name="Orden" />
<property name="Tipo" />
<property name="Estado" />
<property name="Fecha" type="Date"/>
<bag name="Imagenes" batch-size="10" cascade="all">
<key column="id_menu"/>
<one-to-many class="GaleriaImagen"/>
</bag>
</class>
--
Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---