I want use firesharp for my firebase project but its installing some nugets and 2 nuget package is deprecated and i cant uninstall it, its giving me error.
Error Unable to uninstall 'Microsoft.Bcl.1.1.10' because 'Microsoft.Bcl.Async.1.0.168, Microsoft.Net.Http.2.2.29' depend on it.
Error Unable to uninstall 'Microsoft.Bcl.Async.1.0.168' because 'FireSharp.2.0.4' depends on it.
and I don't want to uninstall firesharp, which I'm using.
i can run debuger but i cant publish or realse my project.
CodePudding user response:
I fixed this problem, just used Firebase.Database nuget and codes on here:
FirebaseHelper.cs
public class FirebaseHelper
{
const string auth = "~Firebase Secret~";
public static FirebaseClient firebase = new FirebaseClient("https://~Your Firebase Url~.firebaseio.com/",
new FirebaseOptions
{
AuthTokenAsyncFactory = () => Task.FromResult(auth)
});
public static string mainChild = "mainChild";
public FirebaseHelper()
{
}
public async Task<Veriler> GetData(string name)
{
try
{
var AllData = await firebase
.Child(mainChild)
.OnceAsync<Veriler>();
var list = AllData.Select(item => new Veriler
{
Name = item.Object.Name,
testData = item.Object.testData
}).ToList();
return new Veriler
{
Name = list[0].Name,
testData = list[0].testData
};
}
catch
{
return null;
}
}
public async void UpdateData(string name, string test)
{
try
{
await firebase
.Child(mainChild)
.Child(name)
.PutAsync(new Veriler() { Name = name, testData = test });
}
catch (Exception) { }
}
public async Task AddData(string name)
{
await firebase
.Child(mainChild)
.Child(name)
.PutAsync(new Veriler() { Name = name, testData = "0" });
}
public async Task DeleteData(string name)
{
try
{
await firebase
.Child(mainChild)
.Child(name)
.DeleteAsync();
}
catch { }
}
}
Veriler.cs
public class Veriler //Firebase Data
{
public string testData { get; set; }
public string Name { get; set; }
}