Hi,
I'm building a windows Forms application using nhibernate. Here's my problem.
I have an object (ClassCliente) witch contains a collection(Contactos). I want to be able to undo the changes done to that collection if i cancel the operation of editing an object(ClassCliente).
The problem is that, if i reload the objects it persists to the database the changes i have done. And if i dont reload the objects, the ones in memory still present the canges I have done to the collection.
Code:
<class name="ClassCliente" table="Clientes" lazy="false">
<id name="ID" type="Int32" unsaved-value="-1">
<generator class="identity" />
</id>
<property name="Nome" type="String" length="50"/>
<bag name="Contactos" table="Contactos" lazy="true">
<key column="IDClientes"/>
<composite-element class="ClassContacto">
<parent name="Cliente" />
<property name="Contacto"/>
<many-to-one name="TipoContacto" column="IDTipoContactos" class="ClassTipoContacto"/>
</composite-element>
</bag>
</class>