Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Change tracking for updates
Using the Snapshotter
The snapshot is used to track the changes to the entity, so that only the properties that have changed will be updated. In the following example only the new
Name will be sent to the database, as the
Age value is the same as it was when the snapshot was started.
IDatabase db = new Database("connString"); var user = db.SingleById<User>(1); // Name = "Ted", Age = 21 var snapshot = db.StartSnapshot(user); // Any changes after this will be recorded. user.Name = "Bobby"; user.Age = 21; db.Update(user, snapshot.UpdatedColumns()); // Only the Name column will be updated
Only the changes that have been made before
UpdatedColumns() is called will be included in the change-set.