예제 #1
0
        public static void StoreObject(Site site, object o, string key, string dataType)
        {
            ///For both scenarios, you should use an observe command from a client with the persistto argument to verify the persistent state for the document, then force an update of the view using stale=false. This will ensure that the document is correctly updated in the view index.
            var bucket = site.GetClient();

            bucket.ExecuteStore(StoreMode.Set, ModelExtensions.GetBucketDocumentKey(dataType, key), o.ToJson(dataType), PersistTo.One);
        }
예제 #2
0
        private void RemovePageWithChildPages(Page page)
        {
            DataHelper.DeleteItemByKey(page.Site, ModelExtensions.GetBucketDocumentKey(ModelExtensions.PageDataType, page.FullName));

            var childPages = ChildPages(page);

            foreach (var item in childPages)
            {
                RemovePageWithChildPages(item);
            }
        }
예제 #3
0
        public override Site Get(Site dummyObject)
        {
            var bucketDocumentKey = ModelExtensions.GetBucketDocumentKey(ModelExtensions.SiteDataType, dummyObject.FullName);

            var site = DataHelper.QueryByKey <Site>(dummyObject, bucketDocumentKey, createModel);

            if (site == null)
            {
                return(base.Get(dummyObject));
            }
            return(site);
        }
예제 #4
0
        public virtual T Get(T dummy)
        {
            var bucketDocumentKey = ModelExtensions.GetBucketDocumentKey(DataType, dummy.UUID);

            var result = DataHelper.QueryByKey <T>(dummy.Site, bucketDocumentKey, CreateModel);

            if (result != null && result.Site == null && dummy.Site != null)
            {
                result.Site = dummy.Site;
            }
            return(result);
        }
예제 #5
0
        public Models.Page Get(Models.Page dummy)
        {
            var bucketDocumentKey = ModelExtensions.GetBucketDocumentKey(ModelExtensions.PageDataType, dummy.FullName);

            return(DataHelper.QueryByKey <Page>(dummy.Site, bucketDocumentKey, createModel));
        }
예제 #6
0
 public void RemoveDraft(Page page)
 {
     DataHelper.DeleteItemByKey(page.Site, ModelExtensions.GetBucketDocumentKey(ModelExtensions.PageDraftDataType, page.FullName));
 }
예제 #7
0
        public Page GetDraft(Page page)
        {
            var bucketDocumentKey = ModelExtensions.GetBucketDocumentKey(ModelExtensions.PageDraftDataType, page.FullName);

            return(DataHelper.QueryByKey <Page>(page.Site, bucketDocumentKey, createModel));
        }
예제 #8
0
 public override void Remove(Site item)
 {
     DataHelper.DeleteItemByKey(item, ModelExtensions.GetBucketDocumentKey(ModelExtensions.SiteDataType, item.Name));
     base.Remove(item);
 }
예제 #9
0
 public virtual void Remove(T item)
 {
     DataHelper.DeleteItemByKey(item.Site, ModelExtensions.GetBucketDocumentKey(DataType, item.UUID));
 }
예제 #10
0
        public static void StoreObject(ISiteObject o, string key, string dataType)
        {
            var bucket = o.Site.GetClient();

            bucket.ExecuteStore(StoreMode.Set, ModelExtensions.GetBucketDocumentKey(dataType, key), o.ToJson(dataType), PersistTo.One);
        }