Entity Framework in Asp .Net Core MVC Part 1

Asp.net-core By Sagar Jaybhay

Entity Framework in Asp.net Core MVC By Sagar Jaybhay Entity framework core also called an EF core. EF is completely re-written from the ground up. Also, we found Entity framework very much similar feature like old versions. EF core is ORM (Object Relational Mapper). It actually some enhancements in ADO.Net which give some automated data accessing and storing functionality. Entity Framework is an extensible and opensource framework and it is worked on Windows, Linux, Mac. Entity framework is cross-platform and the main thing is it is official data access platform…

Read More

What is the difference between addtransient vs addsingleton vs addscoped in asp.net core mvc by Sagar Jaybhay

Asp.net-core By Sagar Jaybhay

addtransient vs addsingleton vs addscoped in asp.net core mvc explained by Sagar Jaybhay Explained different type of dependency injection in asp.net core mvc. To inject service in the controller we use constructor and by using this we inject object of service in controller. Below is our HomeController in this we inject IStudentRepository in Controller by using constructor injection. To inject service in a view we need to use Inject to insert it into view. Below is code for that Now you can see below how we add the repository or…

Read More

Model Binding & Validation In Asp.Net Core MVC by Sagar Jaybhay

Asp.net-core By Sagar Jaybhay

Model Binding & Validation In Asp.net Core by Sagar Jaybhay Model Binding If we are not using model binding then we need to write lots of code to pass that form data to the action method. But by using model binding it is easy to pass data from view to action method in the controller. The types of data we need to pass are maybe simple types like integer, string, double or complex type like Customer, Employee, Student. In asp.net MVC model binding is done automatically from view to controller…

Read More

Tag Helpers In Asp.Net Core MVC

Asp.net-core By Sagar Jaybhay

All about Tag helpers in asp.net core MVC explained by sagar jaybhay Asp page tag helper / Tag helpers in Asp.net Core MVC This is new in Asp.net core. These are a server-side component. It is processed on the server and renders an HTML element in razor files. It is similar to Html helpers There are so many tag helpers like generating the link, creating forms, etc, To use tag helper we need to import these tag helper first. For example, we need to create anchor a tag with the…

Read More

Routing In Asp.Net core By Sagar Jaybhay

Asp.net-core By Sagar Jaybhay

All About Attribute,Default & Token Routing In Asp.Net Core By Sagar Jaybhay There are 2 types of routing Present in Asp.Net Core. Conventional Routing Attribute Routing In MVC core routing is a middle-ware and it is present in a start-up class file. In MVC controller which handles the incoming request and invoke appropriate method. There are 2 ways by which MVC routing enable in our application. Mapping is done by Routing Rules. In the old version of asp.net, we have a route.config file separate for routing but in this, we…

Read More

_Layout & _ViewStart Significance In Asp.Net Core MVC

Asp.net-core By Sagar Jaybhay

_Layout & _ViewStart Significance in Asp.Net Core By Sagar Jaybhay LayoutView In MVC In today’s web application we have above fig-like front-page architecture and in this, we have command left menu, header and footer are common. When you hit any menu item or button on the website only middle-pane which is a dynamic view is changed all things remain the same. If you made all these same functionalities to every page which you have then it becomes tedious to manage and time-consuming so in asp.net core MVC have the common…

Read More

Different Ways To Pass Data From Controller To View In MVC

Asp.net-core By Sagar Jaybhay

Different ways to pass data from controller to view in asp.net core By Sagar Jaybhay There are different ways to pass data from controller to view in asp.net core mvc which are ViewData, ViewBag, and Strongly-typed view. Below is the first way to Pass Data From Controller To View in ASP.NET CORE . ViewData: We pass data in ViewData which is a dictionary. In this, we store information in a key-value manner. We set value in We set data as above and we access this In specified view. To retrieve…

Read More

Details About MVC

Asp.net-core By Sagar Jaybhay

Model-View-Controller By Sagar Jaybhay MVC stands for model view and controller and when client or browser issues a request then it comes to controller first. Then on the basis of requirement controller decide should he called view only or call model and then view. How to enable MVC in the blank template? To enable this you need to AddMvc() method in Configureservice method. This is done by dependency injection. There are 2 types of method one is AddMvc() and another is AddMvcCore() method. To enable this we need to use…

Read More

Significance Of Middle-Ware In Asp.Net Core

Asp.net-core By Sagar Jaybhay

Middle-Ware in Asp.Net Core By Sagar Jaybhay In asp .net core Middle-ware play’s an important role in handling incoming and outgoing HTTP request. This is also used for authorization and authentication. The main use of this is to set up the request processing pipeline. There are different kinds of middle-ware present in asp.net core. Log writing middle-ware Static file serve middle-ware Authentication and Authorization middle-ware. This middle-ware pipeline decides or determines how the request is processing. How middle-ware work in asp.net core? Middle-ware is configured in the application startup class…

Read More

Significance of Launchsetting.json file

Asp.net-core By Sagar Jaybhay

Launch Setting File Importance in Asp.Net Core By Sagar Jaybhay This is default code is created when you create the project. In this file there are 2 default profiles are present IIS Express and by your project name. In this when you run the project by using Ctrl+F5 then IIS  Express profile is used. As per name suggest these file profiles are used to launch the application. What is appsettings.json file in asp.net core? In asp .net core configuration settings are come from different sources and in that one of…

Read More