You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
schotime edited this page Apr 29, 2013
·
4 revisions
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.
IDatabasedb=newDatabase("connString");varuser=db.SingleById<User>(1);// Name = "Ted", Age = 21varsnapshot=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.