public void CacheTest() { IDataSource couchbase = new Couchbase(); IDataSource msSql = new MsSql(); IPersistence cache = new Cache(couchbase, msSql); cache.Write("data"); }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void AssignOwnerToListsIfNeeded(Database database, Couchbase.Lite.Document user) { QueryEnumerator enumerator = GetQuery(database).Run(); if (enumerator == null) { return; } foreach (var row in enumerator) { Couchbase.Lite.Document document = row.Document; string owner = (string)document.GetProperty("owner"); if (owner != null) { continue; } IDictionary<string, object> properties = new Dictionary<string, object>(); properties.PutAll(document.Properties); properties.Put("owner", user.Id); document.PutProperties(properties); } }
/// <summary>Adds all values from the passed in ContentValues.</summary> /// <remarks>Adds all values from the passed in ContentValues.</remarks> /// <param name="other">the ContentValues from which to copy</param> public void PutAll(Couchbase.Lite.Storage.ContentValues other) { mValues.PutAll(other.mValues); }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void DeleteTask(Couchbase.Lite.Document task) { task.Delete(); }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void UpdateCheckedStatus(Couchbase.Lite.Document task, bool @checked ) { IDictionary<string, object> properties = new Dictionary<string, object>(); properties.PutAll(task.GetProperties()); properties.Put("checked", @checked); task.PutProperties(properties); }
public _OnClickListener_118(UserAdapter _enclosing, CheckBox checkBox, Couchbase.Lite.Document user) { this._enclosing = _enclosing; this.checkBox = checkBox; this.user = user; }
private bool IsMemberOfTheCurrentList(Couchbase.Lite.Document user) { IList<string> members = (IList<string>)this._enclosing.mCurrentList.GetProperty("members" ); return members != null ? members.Contains(user.GetId()) : false; }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void AddMemberToList(Couchbase.Lite.Document list, Couchbase.Lite.Document user) { IDictionary<string, object> newProperties = new Dictionary<string, object>(); newProperties.PutAll(list.Properties); IList<string> members = (IList<string>)newProperties.Get("members"); if (members == null) { members = new AList<string>(); } members.AddItem(user.Id); newProperties.Put("members", members); try { list.PutProperties(newProperties); } catch (CouchbaseLiteException e) { Log.E(Application.Tag, "Cannot add member to the list", e); } }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void RemoveMemberFromList(Couchbase.Lite.Document list, Couchbase.Lite.Document user) { IDictionary<string, object> newProperties = new Dictionary<string, object>(); newProperties.PutAll(list.Properties); IList<string> members = (IList<string>)newProperties.Get("members"); if (members != null) { members.Remove(user.Id); } newProperties.Put("members", members); list.PutProperties(newProperties); }
internal Query(Database database, Couchbase.Lite.Query query) : this(database, query .GetView()) { limit = query.limit; skip = query.skip; startKey = query.startKey; endKey = query.endKey; descending = query.descending; prefetch = query.prefetch; keys = query.keys; groupLevel = query.groupLevel; mapOnly = query.mapOnly; startKeyDocId = query.startKeyDocId; endKeyDocId = query.endKeyDocId; indexUpdateMode = query.indexUpdateMode; allDocsMode = query.allDocsMode; }
/// <summary>Creates a set of values copied from the given set</summary> /// <param name="from">the values to copy</param> public ContentValues(Couchbase.Lite.Storage.ContentValues from) { mValues = new Dictionary<string, object>(from.mValues); }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void AttachImage(Couchbase.Lite.Document task, Bitmap image) { if (task == null || image == null) { return; } UnsavedRevision revision = task.CreateRevision(); ByteArrayOutputStream @out = new ByteArrayOutputStream(); image.Compress(Bitmap.CompressFormat.Jpeg, 50, @out); ByteArrayInputStream @in = new ByteArrayInputStream(@out.ToByteArray()); revision.SetAttachment("image", "image/jpg", @in); revision.Save(); }