In my last post, I wrote about Google's Firebase services, in particular the realtime database service. In this post, I'll be going through the process of creating a Firebase database which I will be populating with some existing JSON data in the next post. In a future post (or posts), I will then be querying this database from a small C# application to simply list all of the data in the database in a console window. Once this application is working, the fundamentals for connecting to Firebase should become clear and the bulk of the code in the C# application can be re-used in future C# applications, e.g. in a UWP or Web API project. To begin with, a Google account is essential to avail of the Firebase services. Once logged in to a Google account in your browser, navigate to firebase.google.com/. This link will bring you to the main Firebase portal and from here you can access your own personal Firebase console by clicking the GO TO CONSOLE button in the top right of the page, as shown in the image below. If this is your first time accessing Firebase, you may be required to accept the term and conditions for usage of the services. Once at the console, you will be presented with a page similar to the one in the image below. Once at the console, a project must be created before you can begin using the Firebase services. This is fairly self explanatory, so just click Add Project and a popup will be displayed asking for a project name and the country or region in which you are based. Enter a sensible project name here. For the purposes of this post, I am going to use 'my-first-firebase' and select Ireland as the country. You will now be brought to the actual console for this project, which can be seen in the image on the right. There are a number of options in the left hand sidebar and the one we are interested in is the Database one. Click on the Database option and when given the option between Realtime Database or Cloud Firestore, click Get Started under Realtime Database, show in the image below. Your database will now be created and you will be shown the current state of the database, along with the database unique URL and name. I have masked the unique ID of the database in the last image which is probably not necessary, but it can be seen that the database is empty (null) and ready to be used. In the next post, I will be populating this database with some existing JSON data which I have used in a small personal project. The data contains a number of fields per record but it is of a flat structure with no relations. The data also contains an imgur link for each image and I may use this in future if I have the time to create a webapp which also connects to this Firebase data.
Hopefully in the next few posts I will be connecting to this database with a C# console application, querying all of the records from the database and listing each record and its fields in the console.
0 Comments
Leave a Reply. |
Author
2nd Year B.Sc. Software Development Archives
December 2017
Categories |