Posts

Showing posts from October, 2019

Dependency Injection C# Example| Brief Introduction To Dependency Injection | Constructor Dependency Injection

Image
Hello & As-salam u alikum ! , In this article we will learn about the most important and the confusing topic for the new developers and the topic is "  Dependency Injection In C# " What is Dependency Injection ?    It is a software design pattern that allows us to develop  such application code which contain loosely coupled code.As a developer we only focus on developing  features that result the correct desired output, but many of us do not think about future. If we need to make changes in future  in our application code, our application can get crashed if we did not follow any design pattern at the time of developing   application code . see the below example to understand with a humor. The above picture represents your application when you didn't follow any design pattern while developing application . any small change can crash or destroyed your product so we need to follow design patterns to make our code loosely coupled. Dependen...

2-Add New Records in SQL-Server Table in React Js by using Default Template (Part-2)

Image
Hello & As-salam u alikum ! , In this article we will learn to add new records in React js with asp.net core.  Step# 1:   https://dotnetcorecommunity.blogspot.com/2019/10/1-display-data-from-sql-server-table-in.html           Watch Previous Part to fetch data from  controller to React js Component and display on View. Step# 2: Go to the controller ,In our case our controller name is EmployeeController which we had made in last article, so add a new action method in the controller ,below is the code for adding new record method.  [HttpPost]         public void Create(TblEmployee obj)         {             TblEmployee employee = new TblEmployee();                  employee.Department = obj.Department;                 employee.City = obj.C...

How Asp.net Core Application Starts as a Console Application and Converts to a Web Application | Main Method in Asp.net Core | Part-3

Image
 Hello and As-Salaam U Alikum! , In this article we will learn about the main method in Asp.net Core. In the Previous articles we have created so many asp.net core projects but I didn't emphasis on a file which name is " Program.cs " . Yes we are going to discuss it now.  whether you open any type of project e.g. (mvc,empty,web api etc) ,you will surely find this file in your solution explorer. just double click it , you will find two static methods in that file . Main() CreateWebHostBuilder() As we can see CreateWebHostBuilder is called in Main method.First we will  discuss role of main method. As we know that a console application always has a main method from where the execution of program code begins. similarly, Asp.net core application also begin as a console application . The role of main method is to configure the application and starts it as web application . I know this is strange to all .net developers but keep patience ...

How Asp.net core is Different From ASP.NET | asp.net core 2.0 project structure | part-2

Image
Hello & As- salam  u  alikum  ! , In this article we will learn about Folder ,File  or Project Structure in asp.net core If you have ever worked on older versions of ASP.NET  or .net framework using C# ,then you might be surely know that the project file extension is ". csproj " ,Similarly if you used to code in VB. net , then your project file extension was used to be  ". vb proj "  , But in asp.net core these concepts has been changed . File and Folder References : The  ASP.NET Core Project File  does not contain any references for folder or file .  In previous versions of ASP.NET Framework, when we add a folder or a file to the project using Solution Explorer, then a reference to that folder or file is added in the project file. But with ASP.NET Core, the Project File does not include any reference for the Files or Folders added the project using Solution Explorer     ASP.net Core Project File: Right Click on t...

How to Edit and Dispaly Records in Sql Server Table in asp.net core MVC C# (db First Approach EF-CORE) (Part-8)

Image
Hello & As- salam  u  alikum  ! , In this article we will learn to edit or modify records and display a single record on new page using query string. Note : For Beginner Guide Articles : https://dotnetcorecommunity.blogspot.com/p/aspnet-core-tutorials-paracticals.html Step#  1:     Watch  previous  article for creating a new record and upload Image  in asp.net core  https://dotnetcorecommunity.blogspot.com/2019/10/how-to-add-new-records-in-sql-server.html Step#  2:     Add a new method "Details" in Custom Controller  and paste the following action method code. [HttpGet]         public async Task<IActionResult> Details(int? id)         {             if (id == null)             {                 return NotFound();     ...