Video není dostupné.
Omlouváme se.

ASP.NET Core Web API | 3-Layer Architecture + AutoMapper (Step By Step) [04]

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • In this video, we will divide our solution into 3 projects: DAL, BLL and Web API. We will also use the AutoMapper to map Entities to class Models and vice verca. We will also use Microsoft's class "ActionResult" in our API.
    Github repo : github.com/charbelh3/3-Tier-a...
    Leave a like and subscribe if this helped!
    Any video suggestions? Let me know in the comments.
    0:00-1:05 : Recap of previous episode
    1:05-1:41 : Introducing the Topics (Multi-Layer Application and AutoMapper)
    1:42-4:26 : Adding 2 Different Class library Projects
    4:26- 5:06: Explaining Business Logic Layer and Data Access Layer
    5:07- 6:24 : Adding the project references
    6:24-7:00: Moving the repository folder to the DAL
    7:01-9:02 : Installing Entity Framework packages in DAL
    9:02-9:33 : Deleting unused packages from Web API
    9:33-11:14 : Calling PersonBLL from PersonController APIs
    11:15-12:05 : Introducing Model classes vs Entities Idea
    12:05-13:28: Calling the DAL functions from BLL
    13:28-14:35 : Explaining each layer's function to clear confusion
    14:36-15:24 : Fixing errors
    15:25-15:38 : Testing the Get Api with the new Project Structure
    15:39-16:42 : Creating a PersonModel Class in BLL
    16:43-17:11 : Why Use Class Models since we have Entity Classes?
    17:12-20:50 : Reason #1 to use Class Models
    20:51-21:40 : Reason #2 to use Class Models
    21:41-21:58: Introducting the AutoMapper
    21:58- 25:04: Dividing the GetPersonByID API function through 3 different layers
    25:05-27:13 : Returning ActionResult Type in our Controller APIs
    27:13-28:28 : Installing AutoMapper Package
    28:28-30:33 : Creating and configuring our PersonMapper
    30:34-34:23 : Using our PersonMapper in BLL
    34:24-35:19 : Testing the GET APIs that return Class Models
    35:19- 38:25 : Dividing The Post API through the different layers + Mapping with AutoMapper
    38:26-39:40 : Testing the Post API after the changes
    39:41 - 40:29 : Outro

Komentáře • 54

  • @PasinduBroomer
    @PasinduBroomer Před 2 lety +1

    thanks alot. so easy to understand. searched everywhere for this. good luck man

  • @RohanKumar-zp7wu
    @RohanKumar-zp7wu Před rokem

    Great series. Totally beginner friendly.

  • @rededu5356
    @rededu5356 Před 2 lety

    Good job sir. I now finally understand the 3 layer structure. And your example is really close to the real world application of the layer. Morepowerand God bless sir

  • @juhanhossain7594
    @juhanhossain7594 Před 3 lety +2

    Oh man great work. Please keep the channel running . Take Love

    • @Computerix
      @Computerix  Před 3 lety

      I will ! Thanks for your feedbackk

  • @sajanpv4314
    @sajanpv4314 Před 2 lety

    Thank you very much sir.....i am searching for this around more than a month

  • @anushagpatel123
    @anushagpatel123 Před 2 lety +1

    Bless you. You cleared almost all doubts related to my current project which uses the same Architecture

  • @siim944
    @siim944 Před 2 lety +1

    I like your explanations of why something is needed. Thanks!

  • @Beni352
    @Beni352 Před 2 lety

    Very important video this one. Any aspiring developers needs to take notes. Thanks for explaining

  • @azstech3530
    @azstech3530 Před rokem

    Thank you so much, you have cleared my alot of confusions, best regards from Pakistan

  • @todorg.6868
    @todorg.6868 Před rokem

    Great explanation. You made everything very clear. Thank you.

  • @fayeazahmedrhythm7460
    @fayeazahmedrhythm7460 Před 2 lety

    Very helpful

  • @azurehecate4882
    @azurehecate4882 Před 3 měsíci

    omg works like a charm

  • @sandeepmurmu9734
    @sandeepmurmu9734 Před 2 lety

    Good job buddy.

  • @mohammedkarem9709
    @mohammedkarem9709 Před rokem

    Thanks for this video

  • @nicholascaibigan7530
    @nicholascaibigan7530 Před 2 lety

    one of the best tutorials :D

  • @Juznik1389
    @Juznik1389 Před rokem

    Great video! Thank you!!

  • @arunkumarsingh8754
    @arunkumarsingh8754 Před 3 lety

    Awesome

  • @anoopkumar6984
    @anoopkumar6984 Před rokem

    Thank You so much for your Video It really Helpful For me

  • @srinathkolloju3172
    @srinathkolloju3172 Před rokem

    Super

  • @bahadirerdun6801
    @bahadirerdun6801 Před 3 lety +1

    A very successful education. A very useful tutorial. Looking forward to more of your videos. I hope you reach a high number of followers in a short time. People like you deserve to succeed. Best wishes. Greetings.

    • @Computerix
      @Computerix  Před 3 lety

      Thank you so much! More videos coming soon

  • @puckpovier1559
    @puckpovier1559 Před 7 měsíci +1

    thx

  • @nouchance
    @nouchance Před rokem

    THANK YOU BRO

  • @Marc-sd9hy
    @Marc-sd9hy Před 2 lety

    Thanks, it helpe me a lot.
    I have a question, what if we have a relationship (many to many), is there a way to configure automapping between tables and get data?

  • @ramyasrinivasan6774
    @ramyasrinivasan6774 Před 2 lety +1

    Kindly put like working demo means like creating the project and database
    So beginners will understand clearly

    • @Computerix
      @Computerix  Před 2 lety +1

      This is a part of a series, I have created a database and used entity framework as ORM in previous episodes.

  • @mdrifatislam1170
    @mdrifatislam1170 Před rokem

    Can you add Identity framework to this project to manage multiple user for example admin, user, seller, etc?

  • @MaheshMahi-zl9pj
    @MaheshMahi-zl9pj Před rokem

    May i know how to call store procedure in you are project

  •  Před 3 lety

    It seems that this web api can only be tested on Postman, when I run the app, it fails because the interface cannot be displayed on the web browser.

    • @Computerix
      @Computerix  Před 3 lety +3

      Hello, can you specify what you mean by "it fails"? What errors does it show?
      If the API works on postman, then you can type the same route in the search bar of any browser and you would still see the data being retrieved (You can only call GET Apis on the browser search bar)
      Now in case you're using Angular, react js or any other front-end technology, you would need to enable "CORS" in your backend, that way you can make api calls from the frontend. By default it's disabled, in that case you won't be able to call the APIs except from Postman, so you would need to enable CORS, add it in the services and Middleware.
      Hope this helps

    •  Před 3 lety +1

      @@Computerix oh i saw video you show me test api by swagger UI, i did it ^^ thank you so much

    • @Computerix
      @Computerix  Před 3 lety +1

      @ you're welcome :)

  • @mytrolls5866
    @mytrolls5866 Před 2 lety +1

    How did the connection string is invoked ?

    • @Computerix
      @Computerix  Před 2 lety

      I'm not sure what you mean
      You store the connection string in the appSettings.json and you can read values from it dynamically in your code.
      In this tutorial, I just copy pasted the connection string and added it in PersonDBContext ( check the OnConfiguring method) in the Data_Access_Layer project.
      That way, any time you create a new instance of the PersonDbContext to perform operations on the database, that connection string is used.
      However, you should not store it visibly when it production. You should read it dynamically instead, and the connection string would be stored in a secure vault.
      I hope this answered your question.
      Check the github repo in the description

    • @mytrolls5866
      @mytrolls5866 Před 2 lety

      @@Computerix Thank you

  • @chetanadesale6762
    @chetanadesale6762 Před rokem

    Thank you.... Here we have to do migration to create table??

    • @Computerix
      @Computerix  Před rokem

      in this project I was using the database first approach with Entity Framework, so what I would do is create the tables first and whenever I make some changes, I would run the scaffold command again to regenerate the new entities, leaving my models untouched in the business logic layer
      this might help czcams.com/video/SnU4Ulee_NI/video.html

  • @abhaykumarsharma5672
    @abhaykumarsharma5672 Před 2 lety

    I am facing with the connection String like where I need to place the connection String

    • @Computerix
      @Computerix  Před 2 lety

      You store the connection string in the appSettings.json and you can read values from it dynamically in your code.
      In this tutorial, I just copy pasted the connection string and added it in PersonDBContext ( check the OnConfiguring method) in the Data_Access_Layer project.
      That way, any time you create a new instance of the PersonDbContext to perform operations on the database, that connection string is used.
      However, you should not store it visibly when it production. You should read it dynamically instead, and the connection string would be stored in a secure volt.
      I hope this answered your question.

  • @calzaharris7816
    @calzaharris7816 Před rokem

    creat more videos of this

  • @siim944
    @siim944 Před 2 lety

    I can't get CORS working. Can you give some tips?

    • @Computerix
      @Computerix  Před 2 lety +1

      stackoverflow.com/questions/31942037/how-to-enable-cors-in-asp-net-core
      Hopefully this can help you

  • @delightful730
    @delightful730 Před 8 měsíci

    You did not use Dapper ? in this project

    • @Computerix
      @Computerix  Před 8 měsíci +1

      No, I used Entity Framework Core

  • @ghpalash986
    @ghpalash986 Před 3 lety

    would you like to share your source code!

    • @Computerix
      @Computerix  Před 3 lety +1

      Added ! You can find the github repo in the description :)