Firebase is a platform that allows you to build mobile & web apps without a server-side programming language. Here we will only discuss how to include Firebase with a program.
If u want to know about how to create a file in MVC Code 2.1 u can see this link
https://docs.microsoft.com/en-us/aspnet/core/tutorials/?view=aspnetcore-2.1
But we can also see some images for Creating Project in MVC CORE 2.1.
[1]. Home Page of Visual Studio:
[2] Creating New Project:
Go to File > New > Project
[3] Name of New Project and Press Ok.
[4] Categories of New Project, Select Web-Application (Model-View-Controller) and press OK
[5] This is Home Page of New Created Project and on Left hand side File Structure of MVC Core 2.1.
First, we need to know what is Firebase???
Firebase is a mobile and web application development platform developed by Firebase, Inc. in 2011, then acquired by Google in 2014.
Firebase is a Backend-as-a-Service (BaaS) that started as a ‘YC11’ startup and grew up into a next-generation app-development platform on Google Cloud Platform.
Firebase has a very smart and well-developed API. Firebase works like a server, API, and Database. These APIs can be modified as per our needs.
Now, we need to sign-in in Firebase Console with our Gmail accounts.
Then it should be like this.
[1] First go to https://console.firebase.google.com/ and Press ok of Term and Condition
[2] Click on “Add Project” then name new Project like “TestFirebase” and click on Create Project.
[3] It will show us like this and go to “Develop” > “Database”.
[4] It will Show us Database Approach use in Firebase.
[5] Go to Settings> General.
[6] Click on “Add Firebase to your web app” and Get Firebase Generated Unique Key Script
We will get our individual project script of firebase we need to copy the script and get to include this in our MVC CORE 2.1 project file.
Like I have this,
Firebase offers many features like,
– Real-time database,
– Push notification,
– Firebase Analytics,
– Firebase Authentication,
– Firebase Cloud Messaging,
– Firebase Storage,
– Firebase Hosting,
– Firebase Test Lab For Android,
– Firebase Crash reporting,
– Firebase Notification,
– Firebase App Indexing,
– Firebase Dynamic link,
– Firebase Invites,
– Firebase Adwords
Firebase has core features like
Real-time database :
A regular database requires Http call sync and get data from the database. But firebase works with Web Socket. Web Sockets are much faster than HTTP.
Firebase Storage :
File storage provides binary files to save file. It has its own system of security rules to protect your Google Cloud bucket from the masses while granting detailed write privileges to your authenticated clients.
Authentication :
Firebase authentication has been built with an email and password authentication system. It also provides Direct authentication from Google, Facebook, Twitter and GitHub.
Firebase Hosting :
Firebase includes hosting service for our files. It serves them from a global CDN with HTTP/2.
It also has Remote Config, TestLab, Crash Reporting, Push Notification, Dynamic Links, AdMob etc.
There are many Pros and Cons of Firebase:
Pros:-
– JSON (JavaScript Object Notation) storage means no barrier between data and objects
– Email and Password, Google, Facebook and GitHub authentication
– Real-time data
– Well Developed API
– File Hosting
– Firebase storage File Hosting
– Google Cloud Storage
– Built-in security at data node level
– Serverless
Cons:-
– Limited free data storage.
– It only contains simple CRUD operation. Firebase doesn’t use complex queries like join.
– No MapReduce
Firebase with MVC CORE 2.1:
– Firebase works as a simple script in MVC core 2.1.
– Firebase uses foreach loop for retrieving data from firebase node structure.
– Firebase has an n-level node structure.
– Firebase includes Create, Update, Delete function to run API.
– We can use Firebase with both sides like
1. Changing Data from Code
2. Changing Data from Firebase Console Database
It works like API, so it can catch in the backend with HttpPost method. Then it is simple to process to a database. This firebase script runs on View Page in MVC Core 2.1.
We can Connect this Script with Core like this,
[1] Add new Javascript file in Project. Go to wwwroot > js > Add > New Item.
[2] Choose Javascript file Category and Name that File like “FireBaseScript”.
[3] Paste the Firebase Key Script Here.
[4] And call Javascript File Like this in View page.
To Update database from firebase we need these type of codes in Script
And We can Update Data of Firebase from Firebase with this type of code in Script,
Conclusion:
Developers can find all the required information for implementing firebase to MVC Core 2.1. It discusses the basic features of Firebase, its advantages, and disadvantages. One can also know how to Create Project in MVC Core 2.1, how to use Firebase database and how to implement Firebase script in MVC Core 2.1
[References]
1. Google Firebase: https://firebase.google.com
2. https://docs.microsoft.com/en-us/aspnet/core/tutorials/?view=aspnetcore-2.1
3. https://en.wikipedia.org/wiki/Firebase
4. https://howtofirebase.com/what-is-firebase-fcb8614ba442
5. https://medium.com/@puthnith/firebase-for-ios-invalid-api-key-cdde76ff92c4
6. https://www.quora.com/What-is-firebase
7. https://console.firebase.google.com/
8. https://stackify.com/wp-content/uploads/2017/10/NET-core-2.1-1-793×397.png