コード例 #1
0
 /// <summary>
 /// Overwrites existing object with given key leaving any missing properties intact in firebase.
 /// </summary>
 /// <param name="key"> The key. </param>
 /// <param name="obj"> The object to set. </param>
 /// <param name="syncOnline"> Indicates whether the item should be synced online. </param>
 /// <param name="priority"> The priority. Objects with higher priority will be synced first. Higher number indicates higher priority. </param>
 public static void Patch <T>(this RealtimeDatabase <T> db, string key, T obj, bool syncOnline = true, int priority = 1)
     where T : class
 {
     db.Set(key, obj, syncOnline ? SyncOptions.Patch : SyncOptions.None, priority);
 }
コード例 #2
0
 /// <summary>
 /// Do a Patch for a nested property specified by <paramref name="propertyExpression"/> of an object with key <paramref name="key"/>.
 /// </summary>
 /// <typeparam name="T"> Type of the root elements. </typeparam>
 /// <typeparam name="TProperty"> Type of the property being modified</typeparam>
 /// <param name="db"> Database instance. </param>
 /// <param name="key"> Key of the root element to modify. </param>
 /// <param name="propertyExpression"> Expression on the root element leading to target value to modify. </param>
 /// <param name="value"> Value to patch. </param>
 /// <param name="syncOnline"> Indicates whether the item should be synced online. </param>
 /// <param name="priority"> The priority. Objects with higher priority will be synced first. Higher number indicates higher priority. </param>
 public static void Patch <T, TProperty>(this RealtimeDatabase <T> db, string key, Expression <Func <T, TProperty> > propertyExpression, TProperty value, bool syncOnline = true, int priority = 1)
     where T : class
 {
     db.Set(key, propertyExpression, value, syncOnline ? SyncOptions.Patch : SyncOptions.None, priority);
 }
コード例 #3
0
 /// <summary>
 /// Delete a nested property specified by <paramref name="propertyExpression"/> of an object with key <paramref name="key"/>. This basically does a Put with null value.
 /// </summary>
 /// <typeparam name="T"> Type of the root elements. </typeparam>
 /// <typeparam name="TProperty"> Type of the property being modified</typeparam>
 /// <param name="db"> Database instance. </param>
 /// <param name="key"> Key of the root element to modify. </param>
 /// <param name="propertyExpression"> Expression on the root element leading to target value to modify. </param>
 /// <param name="value"> Value to put. </param>
 /// <param name="syncOnline"> Indicates whether the item should be synced online. </param>
 /// <param name="priority"> The priority. Objects with higher priority will be synced first. Higher number indicates higher priority. </param>
 public static void Delete <T, TProperty>(this RealtimeDatabase <T> db, string key, Expression <Func <T, TProperty> > propertyExpression, bool syncOnline = true, int priority = 1)
     where T : class
     where TProperty : class
 {
     db.Set(key, propertyExpression, null, syncOnline ? SyncOptions.Put : SyncOptions.None, priority);
 }
コード例 #4
0
 /// <summary>
 /// Deletes the entity with the given key.
 /// </summary>
 /// <param name="key"> The key. </param>
 /// <param name="syncOnline"> Indicates whether the item should be synced online. </param>
 /// <param name="priority"> The priority. Objects with higher priority will be synced first. Higher number indicates higher priority. </param>
 public static void Delete <T>(this RealtimeDatabase <T> db, string key, bool syncOnline = true, int priority = 1)
     where T : class
 {
     db.Set(key, null, syncOnline ? SyncOptions.Put : SyncOptions.None, priority);
 }