Repository Pattern In ASP.NET Core Web API

preview_player
Показать описание

In this video, we are going to learn how to create the Repository Pattern in an ASP.NET Core application.

The code for .NET 5 is almost the same as the one in the video. There is one small difference related to the Pomelo library. Please read the first article linked below to learn more about it. Basically, you have to modify the library version (prerelease) and slightly modify the usage of the UseMySql method.

LINKS MENTIONED IN THE VIDEO:
To visit the whole article and download the source code visit:
To read the EntityFramework Core series visit:
To read more about the ASP.NET Core Web API series, visit:

FOLLOW US ON SOCIAL MEDIA!

VIDEO SUMMARY:
With the Repository pattern, we create an abstraction layer between the data access and the business logic layer of an application. By using it, we are promoting a more loosely coupled approach to accessing our data from the database. Also, the code is cleaner and easier to maintain and reuse. Data access logic is in a separate class, or set of classes called a repository, with the responsibility of persisting the application’s business model.
Рекомендации по теме
Комментарии
Автор

Thank you all for watching and for your support.

CodeMaze
Автор

I just love how you do not even tell us what the other projects are or contain, it is so useful

Gojam
Автор

For anyone following this and find it a bit fast paced you really need to buy the book with the blazor wasm course. They have an offer whereby you buy one you get both. It is an excellent book and tutorial and use it as a base template for all my projects.

parko
Автор

Thank you so much!
for sharing their knowledge.
Please keep posting more great quality videos. In a few minutes, you have left me a great teaching.
I follow each of your videos. and they are fantastic.

Waiting for the next video. thanks again.!
from Peru.

juanalfredogutierrez
Автор

Very good. Concise and perfectly well explained

PorkopekPeres
Автор

Nice and informative. Thank you so much.

saddamhossaindotnet
Автор

Great work, I really learn a lot from this page's content and videos, keep on, and I hope more videos about the most important design patterns in web api core , and lots of thanks in advance

mr.ammarahmedbiology
Автор

Instant subscribe your channel brother nice explanation

Hangout
Автор

Hello Team Code Maze,
I have a question : Don't we need a business layer in this project ?
If yes, I guess we need to create a service( for business logice ) and implementation. and then Can we call that Business Layer Service and implementation from the controller ? instead of calling the wrapper directly in the controller ?

As i am building a big project, i need a place to inject the business logic somewhere.

InCircle
Автор

Great Work Code Maze, you kept simple and precise. I had one question though. In your Respository Wrapper, you have both account and owner respository. In you API controller class, you have to both of them but is this right? Should my "Account" Controller know about "Owner" Repository?

arihantjain
Автор

Well presented content. I wonder if appending no tracking to the repository base is wise. Doing this tightly couples the repo with EF.. be interested to hear your feedback.

ivanvincent
Автор

Thanks for the nice content. Can we use only repository classes without unit of work ie wrapper class in your case.

gleamofcolor
Автор

Is the wrapper part of what is called the unit of work pattern?

JoseAlvarez-dlhm
Автор

Nice article. But how do you perform a query when you need to return Accounts with the child collections also populated?

albxdotcom
Автор

Data Annitation is For ViewModel, there is an incorrect use to define tables, the entities should be clean, or better known as 'Pocos Classes' For table definition you should use API fluent over DataAnnotation. In other hands, the controller must inject a service interface that receives and returns ViewModels, so that service interface is in a layer that receives Models and transforms them to viewModels and vice versa (with autoMappers For example)

alfredorodriguez
Автор

Good Job 👌 where I can downloads source code

abhaypratapsingh
Автор

Hi Code Maze,
Thanks for Sharing your knowledge, This will help us.
Can we use repository pattern in ADO.net connection instead of entity?
If Yes, Please make a video for the same.
Thanks in advance.

ashishkumarsahu
Автор

great and easy to learn. but when I added the NLog and nLog.config file in the main application and test the logging functionality, it's throwing the error for 'Failed to load NLog LoggingConfiguration. Searched the following locations:
- f:path....\..\..".
how can I get out of it?

aliajmat
Автор

Why do we need multiple inheritance in OwnerRepository and AccountRepository.

qaerdogan
Автор

Aren't you suppose to pass dependency from startup for Account Repository and Owner Repository instead of newing up the repo objects in Repository Wrapper Class, "new is the glue"

pushpakp
visit shbcf.ru