Firebase. Database. DatabaseReference
A Firebase reference represents a particular location in your FirebaseDatabase and can be used for reading or writing data to that FirebaseDatabase location.
Summary
A Firebase reference represents a particular location in your FirebaseDatabase and can be used for reading or writing data to that FirebaseDatabase location. This class is the starting point for all Database operations. After you've initialized it with a URL, you can use it to read data, write data, and to create mores instances of DatabaseReference.
Inheritance
Inherits from: Firebase.Database.Query
Properties |
|
---|---|
Database
|
Gets the Database instance associated with this reference.
|
Key
|
string
The last token in the location pointed to by this reference
|
Parent
|
A DatabaseReference to the parent location, or null if this instance references the root location.
|
Root
|
Public functions |
|
---|---|
Child(string pathString)
|
Get a reference to location relative to this one
|
Equals(object other)
|
override bool
Returns true if both objects reference the same database path.
|
GetHashCode()
|
override int
A hash code based on the string path of the reference.
|
OnDisconnect()
|
Provides access to disconnect operations at this location
|
Push()
|
Create a reference to an auto-generated child location.
|
RemoveValueAsync()
|
Task
Set the value at this location to 'null'
|
RunTransaction(Func< MutableData, TransactionResult > transaction)
|
Task< DataSnapshot >
Run a transaction on the data at this location.
|
RunTransaction(Func< MutableData, TransactionResult > transaction, bool fireLocalEvents)
|
Task< DataSnapshot >
Run a transaction on the data at this location.
|
SetPriorityAsync(object priority)
|
Task
Set a priority for the data at this Database location.
|
SetRawJsonValueAsync(string jsonValue)
|
Task
Set the data at this location to the given string json represenation.
|
SetRawJsonValueAsync(string jsonValue, object priority)
|
Task
Set the data and priority to the given values.
|
SetValueAsync(object value)
|
Task
Set the data at this location to the given value.
|
SetValueAsync(object value, object priority)
|
Task
Set the data and priority to the given values.
|
ToString()
|
override string
The full location url for this reference.
|
UpdateChildrenAsync(IDictionary< string, object > update)
|
Task
Update the specific child keys to the specified values.
|
Public static functions |
|
---|---|
GoOffline()
|
void
|
GoOnline()
|
void
|
Properties
Database
FirebaseDatabase Database
Key
string Key
The last token in the location pointed to by this reference
Parent
DatabaseReference Parent
A DatabaseReference to the parent location, or null if this instance references the root location.
Public functions
Child
DatabaseReference Child( string pathString )
Get a reference to location relative to this one
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
A new DatabaseReference to the given path
|
Equals
override bool Equals( object other )
Returns true if both objects reference the same database path.
GetHashCode
override int GetHashCode()
A hash code based on the string path of the reference.
OnDisconnect
OnDisconnect OnDisconnect()
Provides access to disconnect operations at this location
Details | |
---|---|
Returns |
An object for managing disconnect operations at this location
|
Push
DatabaseReference Push()
Create a reference to an auto-generated child location.
Create a reference to an auto-generated child location. The child key is generated client-side and incorporates an estimate of the server's time for sorting purposes. Locations generated on a single client will be sorted in the order that they are created, and will be sorted approximately in order across all clients.
Details | |
---|---|
Returns |
A DatabaseReference pointing to the new location
|
RemoveValueAsync
Task RemoveValueAsync()
Set the value at this location to 'null'
Details | |
---|---|
Returns |
The Task{TResult} for this operation.
|
RunTransaction
Task< DataSnapshot > RunTransaction( Func< MutableData, TransactionResult > transaction )
Run a transaction on the data at this location.
A transaction is a data transformation function that is continually attempted until the DatabaseReference location remains unchanged during the operation.
Details | |||
---|---|---|---|
Parameters |
|
RunTransaction
Task< DataSnapshot > RunTransaction( Func< MutableData, TransactionResult > transaction, bool fireLocalEvents )
Run a transaction on the data at this location.
A transaction is a data transformation function that is continually attempted until the DatabaseReference location remains unchanged during the operation.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
SetPriorityAsync
Task SetPriorityAsync( object priority )
Set a priority for the data at this Database location.
Set a priority for the data at this Database location. Priorities can be used to provide a custom ordering for the children at a location (if no priorities are specified, the children are ordered by key).
You cannot set a priority on an empty location. For this reason setValue(data, priority) should be used when setting initial data with a specific priority and setPriority should be used when updating the priority of existing data.
Children are sorted based on this priority using the following rules:
- Children with no priority come first.
- Children with a number as their priority come next. They are sorted numerically by priority (small to large).
- Children with a string as their priority come last. They are sorted lexicographically by priority.
- Whenever two children have the same priority (including no priority), they are sorted by key. Numeric keys come first (sorted numerically), followed by the remaining keys (sorted lexicographically).
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The Task{TResult} for this operation.
|
SetRawJsonValueAsync
Task SetRawJsonValueAsync( string jsonValue )
Set the data at this location to the given string json represenation.
Details | |
---|---|
Returns |
The Task{TResult} for this operation.
|
SetRawJsonValueAsync
Task SetRawJsonValueAsync( string jsonValue, object priority )
Set the data and priority to the given values.
Details | |
---|---|
Returns |
The Task{TResult} for this operation.
|
SetValueAsync
Task SetValueAsync( object value )
Set the data at this location to the given value.
Set the data at this location to the given value. Passing null to setValue() will delete the data at the specified location. The allowed types are:
- bool
- string
- long
- double
- IDictionary{string, object}
- List{object}
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The Task{TResult} for this operation.
|
SetValueAsync
Task SetValueAsync( object value, object priority )
Set the data and priority to the given values.
Set the data and priority to the given values. Passing null to setValue() will delete the data at the specified location. The allowed types are:
- bool
- string
- long
- double
- IDictionary{string, object}
- List{object}
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The Task{TResult} for this operation.
|
ToString
override string ToString()
The full location url for this reference.
UpdateChildrenAsync
Task UpdateChildrenAsync( IDictionary< string, object > update )
Update the specific child keys to the specified values.
Update the specific child keys to the specified values. Passing null in a map to updateChildren() will Remove the value at the specified location.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The Task{TResult} for this operation.
|
Public static functions
GoOffline
void GoOffline()