bugthesystem / FireSharp

An asynchronous cross-platform .Net library for Firebase
The Unlicense
693 stars 147 forks source link

Nodes MAnage #93

Closed jordinola closed 7 years ago

jordinola commented 7 years ago

Hi, I would like to know if there is any way to handle the nodes that are created when you push an objec? There is the autogenerated key but I need to change that key for a custom value.

Thxs in advance

arcosmin commented 7 years ago

You will need to use set instead of push. And provide the custom key value in the url. If Firebase can't resolve it, it will be created.

var test = new TestClass()
            {
                Id = "random_string",
                Name = "Test",
                Surname = "Test"
            };

SetResponse response = await _client.SetAsync($"/{test.Id}", test);
TestClass result = response.ResultAs<TestClass>();