Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase in c# (API recommendation)

Tags:

c#

.net

firebase

I am trying to make a simple program using a firebase database. But i would like to code my client in C# is there any good APIs available? I found a few but some are lacking functions and i would like to know the opinion of someone more experienced in these waters.

like image 636
wannabeLearner Avatar asked Dec 03 '16 22:12

wannabeLearner


People also ask

What is Firebase in programming?

Firebase is an app development platform that helps you build and grow apps and games users love. Backed by Google and trusted by millions of businesses around the world.

Can you use Firebase with C++?

Access Firebase entirely from your C++ code, without having to write any platform-native code. The Firebase SDK also translates many language-specific idioms used by Firebase into an interface more familiar to C++ developers.

Does Firebase need coding?

So, if you're using one of the Firebase database options, you typically write code to query the database in your client app. This is different than traditional app development, which typically involves writing both frontend and backend software.

Why is Firebase used?

Google Firebase is a Google-backed application development software that enables developers to develop iOS, Android and Web apps. Firebase provides tools for tracking analytics, reporting and fixing app crashes, creating marketing and product experiment.


1 Answers

There is a REST API which is fairly portable, and you can use this from any .NET language on any supported platform. Dina Cruz has a thorough example of using this API, and you could easily convert this info and use the portable/basic HttpWebRequest type from the BCL instead of whatever Dina used, for example, this is a transliteration of the first POST example from Dina's blog:

var json = Newtonsoft.Json.JsonConvert.SerializeObject(new
{
    user = "UserNameValue",
    message = "MessageValue"
});
var request = WebRequest.CreateHttp("https://tm-admin-test.firebaseio.com/.json");
request.Method = "POST";
request.ContentType = "application/json";
var buffer = Encoding.UTF8.GetBytes(json);
request.ContentLength = buffer.Length;
request.GetRequestStream().Write(buffer, 0, buffer.Length);
var response = request.GetResponse();
json = (new StreamReader(response.GetResponseStream())).ReadToEnd();
// TODO: parse response (contained in `json` variable) as appropriate

There are also several open source projects including Fire#, FirebaseDatabase.net and FirebaseSharp. I'm not sure if these support "all the things."

References

  • Firebase REST API on google.com
  • C# example of using Firebase REST API on dinacruz.com
  • REST examples in C# using WebRequest on StackOverflow.com
  • Fire# project on github.com
  • FirebaseDatabase.net project on github.com
  • FirebaseSharp project on github.com
like image 60
Shaun Wilson Avatar answered Oct 09 '22 10:10

Shaun Wilson