C# Application to Firebase Database - Retrieving Updated Data

Hi guys just a very quick one where we will be going through the process of retrieving parent and child nodes from the Firebase database using a C# application. In order to insert or update parent and child nodes please do have a read on our previous post where we go through this. Please do also ensure your database does not currently contain any base-64 keys as parent nodes as it will make this function extremely tedious and near enough possible.

Before continuing to read onwards I would strongly advise to read on the previous articles working through the basics of C# and Firebase which can be found below:
Inserting data in to the Firebase database
Updating data in the Firebase database
Deleting data in Firebase database
Retrieving all data from the Firebase database
Inserting Individual parent and child nodes in to the Firebase database
Removing random base-64 keys from the parent nodes within the Firebase database

Again as in all posts I must declare that no authentication is used, there are no current rules within the Firebase database.
If however you are wanting to have some form of authentication added to your project check out the below
Authenticating Your C# Application with the Firebase Database


The aim of this project was to allow for the ability to retrieve the child nodes of any given parent, the example in itself is very basic but allows for endless possibilities in a real world application. As usual we will now move on to the different fragments of code starting off with the system header files that are being used. Nothing new within the header files as there arent any new components being used. The project is essentially made up of a stream reader that retrieves and reads the data within the database. We the convert and parse the stream as a JObject and then go about looking for the child nodes within a single parent.





In the code below we start off by creating a web request to our database project in Firebase using its URL. We then stream the response making use of a stream reader. In this example the stream reader is continuously running which wouldnt be effective in real life it would be more suitable for the stream reader to be invoked at certain times only when needed and closing the connection when not needed. We will be looking in to this in future and maybe even go about creating a form application to see how we can make use of all previous posts including this one to form a single application bringing it all together.



Before we continue I want you to know that whilst this project is running we are also running another application in the background that is constantly updating children nodes within our Firebase database. To learn more about this or grab hold of the project code Click Here. The application making use of the time where the current hour, minute and second have been declared as individual variables and are being placed in to the database. Below can be seen how the structure of our current database is perceived.



Looking at the above we can see the parent node to be named Time, consisting of 3 child nodes named Hour, Minute and Second. Where the children node are being updated continuously according to what the current time is.



In the code fragment below we begin by creating a new variable which is the data within the stream reader being parsed as a JObject. We then see the creation of 3 new strings named child1, child2 and child3 which are the children nodes within the parent named Time.



Above we see it says Time which is our parent node, what were doing here is looking for the parent node named time within Firebase. We then see Hour, Minute and Seconds for each of the strings which are our children node and so when the parent and child are found the data is then stored in to this string and presented to us within the console.

If you are not yet familiar with the above code it is suggest you read up on some of the previous articles a list of which can be found below:
Inserting data in to the Firebase database
Updating data in the Firebase database
Deleting data in Firebase database
Retrieving all data from the Firebase database
Inserting Individual parent and child nodes in to the Firebase database
Removing random base-64 keys from the parent nodes within the Firebase database

Source code in full is found below, be sure that you have installed the Newtonsoft.Json package to your C# application for this whole project to work. Also show your support by liking, subscribing to the YouTub channel and sharing all the relevant links.







"If you ever talk to a great programmer, you will find they know their tools like an artist knows their paintbrushes."
-B.Gates-


"Computers themselves, and software yet to be developed, will revolutionize the way we learn."
-S.Jobs-

Authenticating Your C# Application with the Firebase Database

In todays post we will be going through one of the ways we can have some form of basic authentication implemented in to any project. This form of authentication can be applied wherever you want, whether it be you are Posting, Patching, Deleting and more. Keep your project safe and allow only those you want to have permission to access data within your database.


C# Application to Firebase Database - Retrieving The Entire JSON Tree

In todays article we will go through how to retrieve all data from Googles Firebase database using a C# application, this article will not however go through the retrieving specific or individual data but rather we will be returning the entire Json tree. Again as explained in all posts and articles before there is no database authentication being used in this example.


C# Application to Firebase Database - Retrieving Updated Data

In this post we will be going through the way in which you can go about retrieving updated data in Googles Firebase database using a C# application. Retrieving data has been an extremely large request and so its finally here. Please note that if you are wanting to retrieve data that is being posted or inserted in to Firebase the code will need some tweaking and will need to have some changes made. We will be going through this in the next article.