1 | initial version |
Here are the steps to extract data from Firebase's real-time database in C# using the Firesharp library:
Install the Firesharp library: You can install the Firesharp library using the NuGet package manager in Visual Studio or by manually downloading and installing the library.
Set up Firebase credentials: You need to set up Firebase credentials, including the API key, project ID, and database URL. You can obtain these credentials from the Firebase console.
Define the Firesharp client: In your C# code, create a new instance of the Firesharp client and pass in the Firebase credentials.
var firebaseConfig = new FirebaseConfig {
AuthSecret = "your_auth_secret",
BasePath = "https://your-project-id.firebaseio.com/"
};
var client = new FirebaseClient(firebaseConfig);
child
method and OnceAsync
method:var response = await client.Child("myNode").OnceAsync<MyObject>();
List<MyObject> myObjects = response.Select(x => x.Object).ToList();
This will return a list of objects of type MyObject
that are stored in the myNode
node of the Firebase real-time database.
You can also use other Firesharp methods to update, delete, and observe data in the Firebase real-time database.
Note: If you're using Firesharp in a Unity project or in a project that targets .NET Standard 2.0, you'll need to use a different version of the NuGet package.