Video není dostupné.
Omlouváme se.
ASP.NET Core Web API | 3-Layer Architecture + AutoMapper (Step By Step) [04]
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
thanks alot. so easy to understand. searched everywhere for this. good luck man
Great series. Totally beginner friendly.
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
Oh man great work. Please keep the channel running . Take Love
I will ! Thanks for your feedbackk
Thank you very much sir.....i am searching for this around more than a month
Bless you. You cleared almost all doubts related to my current project which uses the same Architecture
I'm glad !
I like your explanations of why something is needed. Thanks!
Thanks for your feedback!
Very important video this one. Any aspiring developers needs to take notes. Thanks for explaining
Thank you!
Thank you so much, you have cleared my alot of confusions, best regards from Pakistan
Great explanation. You made everything very clear. Thank you.
I'm glad !
Very helpful
omg works like a charm
Good job buddy.
Thanks for this video
one of the best tutorials :D
Thanks!
Great video! Thank you!!
Awesome
Thank You so much for your Video It really Helpful For me
You're welcome !
Super
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.
Thank you so much! More videos coming soon
thx
THANK YOU BRO
You're welcome !
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?
Kindly put like working demo means like creating the project and database
So beginners will understand clearly
This is a part of a series, I have created a database and used entity framework as ORM in previous episodes.
Can you add Identity framework to this project to manage multiple user for example admin, user, seller, etc?
May i know how to call store procedure in you are project
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.
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
@@Computerix oh i saw video you show me test api by swagger UI, i did it ^^ thank you so much
@ you're welcome :)
How did the connection string is invoked ?
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
@@Computerix Thank you
Thank you.... Here we have to do migration to create table??
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
I am facing with the connection String like where I need to place the connection String
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.
creat more videos of this
I can't get CORS working. Can you give some tips?
stackoverflow.com/questions/31942037/how-to-enable-cors-in-asp-net-core
Hopefully this can help you
You did not use Dapper ? in this project
No, I used Entity Framework Core
would you like to share your source code!
Added ! You can find the github repo in the description :)