我无法在wpf c#应用程序中使用firesharp库检索Firebase数据

问题描述 投票:0回答:1

我正在尝试从Firebase检索数据。但是我要在其中存储数据的对象的所有属性均为空。请帮助

    using FireSharp.Config;   
    using FireSharp.Interfaces; 
    using FireSharp.Response;


    IFirebaseConfig config = new FirebaseConfig
    {
        AuthSecret= "authsecretexample",
        BasePath= "baspathexample"
    };

    IFirebaseClient client;

'''用于从Firebase检索数据的功能'''

    //RETRIEVE DATA FROM FIREBASE 
    private async void Button_Click_1(object sender, RoutedEventArgs e)
   {
       client = new FireSharp.FirebaseClient(config);
       if(client != null)
       {

            //usernameTxt is textbox in xaml            
           FirebaseResponse response = await client.GetTaskAsync("Information/" + usernameTxt.Text)
           Users obj = response.ResultAs<Users>(); //obj is object of user class in which i want to store data




           //all these MessageBoxes are null
           MessageBox.Show(obj.Name);
           MessageBox.Show(obj.Address);
           MessageBox.Show("Data retireved");//this message is shown

       }
       else
       {
           MessageBox.Show("could not connect");
       }



   }
c# wpf null data-retrieval fire-sharp
1个回答
0
投票

嗨,检查节点或尝试调试响应检查,如果响应返回null或不是

© www.soinside.com 2019 - 2024. All rights reserved.