This project is read-only.
Change Tracking

Rapid Runtime Engine (RRE), monitors changes within a particular EntityManager life cycle. The EntityManager gives you control on the database context you are working on, you can commit , rollback and start a new transaction .

An Entity instance loaded by the entity manager would have been attached to the RRE change listeners. This means that, the changes made to this entity would be tracked and recorded by the RRE based on transaction and context. For example :

using(EntityManager manager = new EntityManager())
      manager.OpenDatabaseSession( );
      Customer customer = manager.LoadEntity<Customer>( 78 );

The above snippet loads the Customer entity using its identity key (Primary key) 78 to fetch the object from the database. The RRE and the Metadata engines built within rapid injects a change tracking property change listeners into the entity loaded. Now let us view the FirstName of the Customer entity.

using( EntityManager manager = new EntityManager() )

      Customer customer = manager.LoadEntity<Customer>( 78 );
      Console.WriteLine( customer.FirstName ); //Prints out Ahmed

      //Change the Customer First Name
      customer.FirstName = "James";

     Console.WriteLine( customer.FirstName ); //Prints out James

 }//Commit and close is called

Console.WriteLine( customer.FirstName ); //Prints out Ahmed

Last edited Apr 22, 2010 at 7:09 AM by ahmedsalako, version 5


No comments yet.