示例#1
0
        /// <summary>
        /// Fan out given item to multiple locations at once. See https://firebase.googleblog.com/2015/10/client-side-fan-out-for-data-consistency_73.html for details.
        /// </summary>
        /// <typeparam name="T"> Type of object to fan out. </typeparam>
        /// <param name="query"> Current node. </param>
        /// <param name="item"> Object to fan out. </param>
        /// <param name="relativePaths"> Locations where to store the item. </param>
        public static async Task FanOut <T>(this ChildQuery child, T item, params string[] relativePaths)
        {
            if (relativePaths == null)
            {
                throw new ArgumentNullException(nameof(relativePaths));
            }

            var fanoutObject = new Dictionary <string, T>(relativePaths.Length);

            foreach (var path in relativePaths)
            {
                fanoutObject.Add(path, item);
            }

            await child.PatchAsync(fanoutObject);
        }
 /// <summary>
 /// Order data by given <see cref="propertyName"/>. Note that this is used mainly for following filtering queries and due to firebase implementation
 /// the data may actually not be ordered.
 /// </summary>
 /// <param name="child"> The child. </param>
 /// <param name="propertyName"> The property name. </param>
 /// <returns> The <see cref="OrderQuery"/>. </returns>
 public static OrderQuery OrderBy(this ChildQuery child, string propertyName)
 {
     return(child.OrderBy(() => propertyName));
 }
 /// <summary>
 /// References a sub child of the existing node.
 /// </summary>
 /// <param name="node"> The child. </param>
 /// <param name="path"> The path of sub child. </param>
 /// <returns> The <see cref="ChildQuery"/>. </returns>
 public static ChildQuery Child(this ChildQuery node, string path)
 {
     return(node.Child(() => path));
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderQuery"/> class.
 /// </summary>
 /// <param name="parent"> The query parent. </param>
 /// <param name="propertyNameFactory"> The property name. </param>
 /// <param name="client"> The owning client. </param>
 public OrderQuery(ChildQuery parent, Func <string> propertyNameFactory, FirebaseClient client)
     : base(parent, () => "orderBy", client)
 {
     this.propertyNameFactory = propertyNameFactory;
 }
 /// <summary>
 /// Order data by $priority. Note that this is used mainly for following filtering queries and due to firebase implementation
 /// the data may actually not be ordered.
 /// </summary>
 /// <param name="child"> The child. </param>
 /// <returns> The <see cref="OrderQuery"/>. </returns>
 public static OrderQuery OrderByPriority(this ChildQuery child)
 {
     return(child.OrderBy("$priority"));
 }
 /// <summary>
 /// Order data by $value. Note that this is used mainly for following filtering queries and due to firebase implementation
 /// the data may actually not be ordered.
 /// </summary>
 /// <param name="child"> The child. </param>
 /// <returns> The <see cref="OrderQuery"/>. </returns>
 public static OrderQuery OrderByValue(this ChildQuery child)
 {
     return(child.OrderBy("$value"));
 }
 /// <summary>
 /// Order data by $key. Note that this is used mainly for following filtering queries and due to firebase implementation
 /// the data may actually not be ordered.
 /// </summary>
 /// <param name="child"> The child. </param>
 /// <returns> The <see cref="OrderQuery"/>. </returns>
 public static OrderQuery OrderByKey(this ChildQuery child)
 {
     return(child.OrderBy("$key"));
 }
 /// <summary>
 /// Order data by given <see cref="propertyNameFactory"/>. Note that this is used mainly for following filtering queries and due to firebase implementation
 /// the data may actually not be ordered.
 /// </summary>
 /// <param name="child"> The child. </param>
 /// <param name="propertyNameFactory"> The property name. </param>
 /// <returns> The <see cref="OrderQuery"/>. </returns>
 public static OrderQuery OrderBy(this ChildQuery child, Func <string> propertyNameFactory)
 {
     return(new OrderQuery(child, propertyNameFactory, child.Client));
 }
 /// <summary>
 /// References a sub child of the existing node.
 /// </summary>
 /// <param name="node"> The child. </param>
 /// <param name="pathFactory"> The path of sub child. </param>
 /// <returns> The <see cref="ChildQuery"/>. </returns>
 public static ChildQuery Child(this ChildQuery node, Func <string> pathFactory)
 {
     return(new ChildQuery(node, pathFactory, node.Client));
 }
示例#10
0
 /// <summary>
 /// Appends shallow=true to the url parameters. This cannot be used with any other filtering parameters.
 /// See https://firebase.google.com/docs/database/rest/retrieve-data
 /// </summary>
 /// <param name="node"> The child. </param>
 /// <returns> The <see cref="ShallowQuery"/>. </returns>
 public static ShallowQuery Shallow(this ChildQuery node)
 {
     return(new ShallowQuery(node, node.Client));
 }