{"action":"created","issue":{"url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase/issues/127","repository_url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase","labels_url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase/issues/127/comments","events_url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase/issues/127/events","html_url":"https://github.com/couchbaselabs/Linq2Couchbase/pull/127","id":145751794,"number":127,"title":"LINQ-19: Add change-tracking to BucketContext","user":{"login":"jeffrymorris","id":454176,"avatar_url":"https://avatars.githubusercontent.com/u/454176?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffrymorris","html_url":"https://github.com/jeffrymorris","followers_url":"https://api.github.com/users/jeffrymorris/followers","following_url":"https://api.github.com/users/jeffrymorris/following{/other_user}","gists_url":"https://api.github.com/users/jeffrymorris/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffrymorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffrymorris/subscriptions","organizations_url":"https://api.github.com/users/jeffrymorris/orgs","repos_url":"https://api.github.com/users/jeffrymorris/repos","events_url":"https://api.github.com/users/jeffrymorris/events{/privacy}","received_events_url":"https://api.github.com/users/jeffrymorris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-04T17:34:19Z","updated_at":"2016-04-06T03:44:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase/pulls/127","html_url":"https://github.com/couchbaselabs/Linq2Couchbase/pull/127","diff_url":"https://github.com/couchbaselabs/Linq2Couchbase/pull/127.diff","patch_url":"https://github.com/couchbaselabs/Linq2Couchbase/pull/127.patch"},"body":"Motivation\r\n----------\r\nThis commit introduces experimental support for change tracking of\r\nentities/POCOs loaded from documents stored in Couchbase server. By enabling\r\nchange tracking through a call to the BeginChangeTracking method on\r\nBucketContext, each POCO or entity that corresponds to a document returned\r\nby a query will be intercepted and proxied. The proxy contains logic for\r\ndetecting any modifications to a document and adding the corresponding\r\nobject to a mutated list. When SubmitChanges is called, the changed\r\ndocuments will be added, updated or deleted on Couchbase Server. Change\r\ntracking be disabled by calling the EndChangeTracking method; which will\r\nremove any modified documents from the mutated list and subsequent queries\r\nwill not be intercepted and proxied.\r\n\r\nModifications\r\n-------------\r\nThe BucketContext is now a subcriber for all proxy modifications when\r\nchange tracking is enabled; any changes to an object which is proxied will\r\nbe bubbled up to the BucketContext and stored in a mutated list. If a new\r\ndocument is added that was not proxied it will be wrapped in a\r\nNewDocumentWrapper class and treated as if it was proxied. Various other\r\nmethods of BucketContext were also modified to support the cases where\r\nchnage tracking is enabled and when it is not enabled. In general, any\r\ndelete, add or mutation persistence will be deferred until SubmitChanges\r\nis called.\r\n\r\nResults\r\n-------\r\nWhen BegingChangeTracking is enabled all documents returned by a query\r\nwill be proxied. If a document is modified, the BucketContext will be\r\nnotified. When SubmitChanges it called, the documents that have been\r\nchanged or added will be persisted to Couchbase."},"comment":{"url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase/issues/comments/206106908","html_url":"https://github.com/couchbaselabs/Linq2Couchbase/pull/127#issuecomment-206106908","issue_url":"https://api.github.com/repos/couchbaselabs/Linq2Couchbase/issues/127","id":206106908,"user":{"login":"jeffrymorris","id":454176,"avatar_url":"https://avatars.githubusercontent.com/u/454176?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffrymorris","html_url":"https://github.com/jeffrymorris","followers_url":"https://api.github.com/users/jeffrymorris/followers","following_url":"https://api.github.com/users/jeffrymorris/following{/other_user}","gists_url":"https://api.github.com/users/jeffrymorris/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffrymorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffrymorris/subscriptions","organizations_url":"https://api.github.com/users/jeffrymorris/orgs","repos_url":"https://api.github.com/users/jeffrymorris/repos","events_url":"https://api.github.com/users/jeffrymorris/events{/privacy}","received_events_url":"https://api.github.com/users/jeffrymorris/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T03:44:33Z","updated_at":"2016-04-06T03:44:33Z","body":"@brantburnett -\r\n\r\nForced pushed the changes. \r\n\r\n-Jeff"}}