Firebase database connection provides a free database. Basically, we can do CRUD operations like Insert, Update, Get and Delete.
Here, I’ve divided the steps for installing and creating a project on the Firebase console panel.
The first step is to open Firebase, and then login into your account. The second step is to click on the console app that takes you to Dashboard, then click on the Create Project, and then add your project name.
![]()
![Create project]()
![Analytics location]()
The third step is to create a real-time database. After that, choose the test mode and click the enable button. So, now your database is created, and you can use this setup for crud operation.
First of all, you have to do is to create an account in Firebase. Here, I attached a link that will help you to create a project in the Firebase console app.
These are some steps listed below that take you to the exact place of Firebase integration with .NET.
Firstly, you need to create a .net project and then install the NuGet package; and name of the package is FireSharp, and the version of the package is 2.0.4.
Now, you will need credentials to perform the CRUD operation.
- To connect with your real-time database, copy the base path from the console app.
![]()
- Then we need the authsecret key, that key you can fetch from the project setting > service account > database secret key.
![Firebase Admin SDK]()
- Lastly, let’s write code in .NET.
// Firebase configuration
IFirebaseConfig ifc = new FirebaseConfig()
{
AuthSecret = "**********x8Ed6HVU0YXlXW-L75ho4ps",
BasePath = "https://we****.firebaseio.com/"
};
IFirebaseClient client;
// Create a user object
User user = new User()
{
Id = 1,
FirstName = "Test 1",
LastName = "Test 2"
};
// Initialize Firebase client
client = new FireSharp.FirebaseClient(ifc);
// Insert data
var set = client.Set("User/" + user.Id, user);
// Delete data
set = client.Delete("User/" + user.Id);
// Update data
set = client.Update("User/" + user.Id, user);
// Retrieve data
set = client.Get("User/" + user.Id);
To explore more classes, please visit the official doc of Firebase Admin .NET SDK: firebase.google.com/docs/reference/admin/dotnet