I want to use firebase realtime database with an ASP.NET MVC app, and I searched through the internet and pretty much found no recourses even in the firebase website, my first question is how to set data without generating a key every time I want add some data.
var currentUserLogin = new LoginData() { TimestampUtc = currentLoginTime };
var firebaseClient = new FirebaseClient("yourFirebaseProjectUrl");
var result = await firebaseClient
.Child("Users/" userId "/Logins")
.PostAsync(currentUserLogin, false);
This code generates a key every single time, I added false
as a second parameter as for not to generate a key but it doesn't seem to work, my second question is where can I find resources related to the subject.
CodePudding user response:
I expect that the client you are using is a wrapper around Firebase's REST API, which interprets a POST
request as a request to add the data as a new child node.
If you want to write the data to the exact path you specify, use a PUT
request, so in your C# code that'd be PutAsync
.