{"id":6309,"date":"2018-07-16T12:58:23","date_gmt":"2018-07-16T12:58:23","guid":{"rendered":"https:\/\/9series-blog.staging9.com\/?p=6309"},"modified":"2026-03-03T10:47:27","modified_gmt":"2026-03-03T10:47:27","slug":"firebase-mvc-core-2-1","status":"publish","type":"post","link":"https:\/\/www.9series.com\/blog\/firebase-mvc-core-2-1\/","title":{"rendered":"Firebase with MVC Core 2.1"},"content":{"rendered":"<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/Firebase-with-MVC-Core-2.1-9series-solutions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3237\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/Firebase-with-MVC-Core-2.1-9series-solutions.jpg\" alt=\"Firebase-with-MVC-Core-2.1 9series solutions\" width=\"800\" height=\"500\" \/><\/a><\/p>\n<p>Firebase is a\u00a0platform that allows you to build mobile &amp; web apps without a\u00a0server-side programming language.\u00a0Here we will only discuss how to include Firebase with a program.<\/p>\n<p>If u want to know about how to create a file in MVC Code 2.1 u can see this link<br \/>\nhttps:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/tutorials\/?view=aspnetcore-2.1<br \/>\nBut we can also see some images for Creating Project in MVC CORE 2.1.<\/p>\n<p><strong>[1]. Home Page of Visual Studio:<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/19.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3292\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/19.jpg\" alt=\"1\" width=\"800\" height=\"425\" \/><\/a><\/p>\n<p><strong>[2] Creating New Project:<\/strong><br \/>\nGo to File &gt; New &gt; Project<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/24.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3293\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/24.jpg\" alt=\"2\" width=\"800\" height=\"428\" \/><\/a><\/p>\n<p><strong>[3] Name of New Project and Press Ok.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/33.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3294\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/33.jpg\" alt=\"3\" width=\"800\" height=\"425\" \/><\/a><\/p>\n<p><strong>[4] Categories of New Project, Select Web-Application (Model-View-Controller) and press OK<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/44.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3295\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/44.jpg\" alt=\"4\" width=\"800\" height=\"428\" \/><\/a><\/p>\n<p><strong>[5] \u00a0This is Home Page of New Created Project and on Left hand side File Structure of MVC Core 2.1.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/53.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3296\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/53.jpg\" alt=\"5\" width=\"800\" height=\"428\" \/><\/a><\/p>\n<p><b>First, we need to know what is Firebase???<\/b><\/p>\n<p><span style=\"font-weight: 400\">Firebase is a mobile and web application development platform developed by Firebase, Inc. in 2011, then acquired by Google in 2014. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Firebase is a Backend-as-a-Service (BaaS) that started as a \u2018YC11\u2019 startup and grew up into a next-generation app-development platform on Google Cloud Platform.<\/span><\/p>\n<p><span style=\"font-weight: 400\">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.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Now, we need to sign-in in Firebase Console with our Gmail accounts.<\/span><\/p>\n<p><strong>Then it should be like this.<\/strong><\/p>\n<p><strong>[1] First go to <a href=\"https:\/\/console.firebase.google.com\/\">https:\/\/console.firebase.google.com\/<\/a> and Press ok of Term and Condition<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/63.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3297\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/63.jpg\" alt=\"6\" width=\"800\" height=\"426\" \/><\/a><\/p>\n<p><strong>[2] Click on \u201cAdd Project\u201d then name new Project like \u201cTestFirebase\u201d and click on Create Project.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/74.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3298\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/74.jpg\" alt=\"7\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p><strong>[3] It will show us like this and go to \u201cDevelop\u201d &gt; \u201cDatabase\u201d.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/84.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3299\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/84.jpg\" alt=\"8\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p><strong>[4] It will Show us Database Approach use in Firebase.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/93.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3300\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/93.jpg\" alt=\"9\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p><strong>[5] Go to Settings&gt; General.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/102.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3301\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/102.jpg\" alt=\"10\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/113.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3302\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/113.jpg\" alt=\"11\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p><strong>[6] Click on \u201cAdd Firebase to your web app\u201d and Get Firebase Generated Unique Key Script<\/strong><\/p>\n<p>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.<\/p>\n<p>Like I have this,<\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/122.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3303\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/122.jpg\" alt=\"12\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Firebase offers many features like,<\/strong><br \/>\n&#8211; Real-time database,<br \/>\n&#8211;\u00a0Push notification,<br \/>\n&#8211;\u00a0Firebase Analytics,<br \/>\n&#8211; Firebase Authentication,<br \/>\n&#8211;\u00a0Firebase Cloud Messaging,<br \/>\n&#8211;\u00a0Firebase Storage,<br \/>\n&#8211;\u00a0Firebase Hosting,<br \/>\n&#8211;\u00a0Firebase Test Lab For Android,<br \/>\n&#8211;\u00a0Firebase Crash reporting,<br \/>\n&#8211;\u00a0Firebase Notification,<br \/>\n&#8211;\u00a0Firebase App Indexing,<br \/>\n&#8211;\u00a0Firebase Dynamic link,<br \/>\n&#8211;\u00a0Firebase Invites,<br \/>\n&#8211; Firebase Adwords<\/p>\n<p><strong>Firebase has core features like<\/strong><br \/>\n<strong>Real-time database :<\/strong><br \/>\nA 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.<\/p>\n<p><strong>Firebase Storage :<\/strong><br \/>\nFile 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.<\/p>\n<p><strong>Authentication :<\/strong><br \/>\nFirebase authentication has been built with an email and password authentication system. It also provides Direct authentication from Google, Facebook, Twitter and GitHub.<\/p>\n<p><strong>Firebase Hosting :<\/strong><br \/>\nFirebase includes hosting service for our files. It serves them from a global CDN with HTTP\/2.<\/p>\n<p>It also has Remote Config, TestLab, Crash Reporting, Push Notification, Dynamic Links, AdMob etc.<\/p>\n<p><strong>There are many Pros and Cons of Firebase:<\/strong><br \/>\n<strong>Pros:-<\/strong><br \/>\n&#8211; JSON (JavaScript Object Notation) storage means no barrier between data and objects<br \/>\n&#8211;\u00a0Email and Password, Google, Facebook and GitHub authentication<br \/>\n&#8211;\u00a0Real-time data<br \/>\n&#8211;\u00a0Well Developed API<br \/>\n&#8211;\u00a0File Hosting<br \/>\n&#8211;\u00a0Firebase storage File Hosting<br \/>\n&#8211;\u00a0Google Cloud Storage<br \/>\n&#8211;\u00a0Built-in security at data node level<br \/>\n&#8211;\u00a0Serverless<\/p>\n<p><strong>Cons:-<\/strong><br \/>\n&#8211;\u00a0Limited free data storage.<br \/>\n&#8211;\u00a0It only contains simple CRUD operation. Firebase doesn\u2019t use complex queries like join.<br \/>\n&#8211;\u00a0No MapReduce<\/p>\n<p><strong>Firebase with MVC CORE 2.1:<\/strong><br \/>\n&#8211;\u00a0Firebase works as a simple script in MVC core 2.1.<br \/>\n&#8211;\u00a0Firebase uses foreach loop for retrieving data from firebase node structure.<br \/>\n&#8211;\u00a0Firebase has an n-level node structure.<br \/>\n&#8211;\u00a0Firebase includes Create, Update, Delete function to run API.<br \/>\n&#8211;\u00a0We can use Firebase with both sides like<br \/>\n1. Changing Data from Code<br \/>\n2. Changing Data from Firebase Console Database<\/p>\n<p>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.<\/p>\n<p><strong>We can Connect this Script with Core like this,<\/strong><br \/>\n<strong>[1] Add new Javascript file in Project. Go to wwwroot &gt; js &gt; Add &gt; New Item.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/132.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3304\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/132.jpg\" alt=\"13\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>[2] Choose Javascript file Category and Name that File like \u201cFireBaseScript\u201d.<\/strong><\/p>\n<p><strong><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/141.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3305\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/141.jpg\" alt=\"14\" width=\"800\" height=\"450\" \/><\/a> <\/strong><\/p>\n<p><strong>[3] Paste the Firebase Key Script Here.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/153.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3308\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/153.jpg\" alt=\"15\" width=\"800\" height=\"450\" \/><\/a><\/p>\n<p><strong>[4] And call Javascript File Like this in View page.<\/strong><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/161.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3309\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/161.jpg\" alt=\"16\" width=\"800\" height=\"95\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">To Update database from firebase we need these type of codes in Script<\/span><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/171.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3310\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/171.jpg\" alt=\"17\" width=\"800\" height=\"281\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">And We can Update Data of Firebase from Firebase with this type of code in Script,<\/span><\/p>\n<p><a href=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/181.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3311\" src=\"https:\/\/9series-blog.staging9.com\/wp-content\/uploads\/2018\/07\/181.jpg\" alt=\"18\" width=\"800\" height=\"339\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Conclusion:<br \/>\n<\/strong>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<\/p>\n<p><b>[References]<\/b><br \/>\n1. Google Firebase: https:\/\/firebase.google.com<br \/>\n2. https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/tutorials\/?view=aspnetcore-2.1<br \/>\n3. https:\/\/en.wikipedia.org\/wiki\/Firebase<br \/>\n4. https:\/\/howtofirebase.com\/what-is-firebase-fcb8614ba442<br \/>\n5. https:\/\/medium.com\/@puthnith\/firebase-for-ios-invalid-api-key-cdde76ff92c4<br \/>\n6. https:\/\/www.quora.com\/What-is-firebase<br \/>\n7. https:\/\/console.firebase.google.com\/<br \/>\n8. https:\/\/stackify.com\/wp-content\/uploads\/2017\/10\/NET-core-2.1-1-793&#215;397.png<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Firebase is a\u00a0platform that allows you to build mobile &amp; web apps without a\u00a0server-side programming language.\u00a0Here we will only discuss how to include Firebase with a program. If u want&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6310,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"dsgo_overlay_header":false,"dsgo_overlay_header_text_color":"","dsgo_overlay_skip_top_bar":false,"_designsetgo_exclude_llms":false,"footnotes":""},"categories":[1446,1429],"tags":[],"class_list":["post-6309","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net-mvc","category-microsoft"],"_links":{"self":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/6309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/comments?post=6309"}],"version-history":[{"count":1,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/6309\/revisions"}],"predecessor-version":[{"id":6329,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/posts\/6309\/revisions\/6329"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/media\/6310"}],"wp:attachment":[{"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/media?parent=6309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/categories?post=6309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9series.com\/blog\/wp-json\/wp\/v2\/tags?post=6309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}