Dependency Injection In .Net Web Api
Create dependency Injection.

Dependency Injection In .Net Web Api


Create dependency Injection.
Configure dependency Injection. in Program.cs file


Day 3/75, In Dot Net How to configure and create Dependency injection in Controller and Service Layer?

first of all, create folders and make folder structure,

In Controller- we create dependency and making our API.

In Service Layer- here Is Business logic, validation.

In Common Layer (inside Model)- In model we define the request body and response body in Model.

IN Repository Layer- Main code of APIs in Repository Layer.

Now create Dependency in blow Screenshots, after that how to configure in program.cs this one screenshot in below.

Why We Use Dependency Injection ---The main advantage of DI (Dependency Injection) is our application is loosely coupled and has provided greater maintainability, testability, and also re-usability.

It is loosely coupled because dependency required by the class is injected from the outer world rather than created themselves directly win-in code.

I hope this first Article Help You

By Ravi Rajput

Need Your Support, Do Like and Share ????


要查看或添加评论,请登录

Ravi Rajput的更多文章

  • Console Class in C#

    Console Class in C#

    I am Writing few basic programs in console class C# (C Sharp)

    2 条评论
  • SQL Database(MSSQL)

    SQL Database(MSSQL)

    SELECT - extracts data from a database UPDATE - updates data in a database DELETE - deletes data from a database INSERT…

    4 条评论
  • Reactjs Curd Operation

    Reactjs Curd Operation

    Hi, I am Writing Here curd operation code in ReactJs, if you want you can implement. and and lets start process.

  • What is System Database in SQL Server Microsoft

    What is System Database in SQL Server Microsoft

    In SQL Server, the system databases are a set of databases that are created and maintained by SQL Server itself. These…

社区洞察

其他会员也浏览了