示例#1
0
        public static bool Store(IDocument document)
        {
            var client = CouchbaseManager.Instance;

            if (string.IsNullOrEmpty(document.Key))
            {
                document.Key = Guid.NewGuid().ToString();
            }
            document.Type = document.GetType().Name;
            var jso = JsonConvert.SerializeObject(document);
            var res = client.Store(StoreMode.Set, document.GetKey(), jso);

            if (res)
            {
                document.AfterSave();
            }
            return(res);
        }