🚀 Join the .NET Web Academy with a 30% discount - closing soon! 👉 www.dotnetwebacademy.com/courses/academy?coupon=dnwas23yt
@Apfelloch Жыл бұрын
Came for a Repo Pattern explanation, stayed for the Dependency Injection explanation. I've watched several videos but it was yours that finally made it 'click' for me. Great example - not too abstract (as those "DI explained in n minutes videos) but also not too complex for beginners like me.
@VictorPraizTech2 жыл бұрын
I came here for the understanding of repository pattern but left with a full understanding of dependency injection. 😅 something I’ve been struggling to understand for weeks. Thanks man.
@PatrickGod2 жыл бұрын
Glad it was helpful! 😅
@seva2814 Жыл бұрын
Thats actually not a Repository Pattern, that isolates the database connection but a service layer
@theonlycaulfield Жыл бұрын
Yes, I am confused on how this is the top result for my query on ".net repository". A repository pattern separates the db connection from the logic in the service layer. This video represents the repository pattern as if it is the thing that the repository pattern is intended to prevent.
@mykhailo-kmet Жыл бұрын
It is not a good explanation of Repository pattern. Repository pattern is for manipulating data as if it a collection. So any repository should have methods for adding, removing and getting data. Otherwise it is just data accessor service
@knightmarerip711 Жыл бұрын
I like how this was explained without using EF, Dapper, etc... just focused on the design pattern. Very well explained!
@annyeonghaseyo1263 ай бұрын
great tutorial but I have a question. If we have 2 components together or separate where we want to show both 5 elements and 50 as in the example, how do we do it? Because from what I understand you need to specify which service to use in the Program.cs. Given that the interface is reusable by many services, how do you decide which services to use based on the context or component?
@38911bytefree Жыл бұрын
Thanks Patrick. I have been trying to learn this yesterday and this vid really clarified some points.I have been following several of you vids, Love the way you exlplain in such a peaceful way. Thanks Sir.
@Bhupin Жыл бұрын
Thank you so much for this...I came to learn Repository Pattern but learned Dependency Injection..I wish I could tell you how much i struggled trying to grasp the concept of Dependency Injection..You have a new subscriber sir!!
@PatrickGod Жыл бұрын
Wonderful! Thank you so much!
@PaulBelter2 ай бұрын
Thank you so Much for this explanation. I am transitioning from Web Form to API and there is so much to learn.
@joaogabrielv.m3282 жыл бұрын
Keep up, Patrick! You are a real God, man :D
@PatrickGod2 жыл бұрын
Wow, thank you so much! 😊
@manuelgamezz2 жыл бұрын
Thanks Patrik, good example.
@PatrickGod2 жыл бұрын
Thanks Manuel, glad I could help!
@normanaranez3232 жыл бұрын
Do you have any idea how to build multi-tenant architecture that has shared code base and a lot of database?
@daydrivver20742 жыл бұрын
Thank you, i know you just don't do the content for me (asked in a one of your videos about this) but many thank you I hope someday I can pay you back, right now I lost my job due to current environment so many thanks for the content.
@qemajlosmani Жыл бұрын
Gut gemacht. Simple and very well put example. I always structure the code and pattern design like this. When you have too many services, be careful. Injecting services into each other in a circular manner can lead to runtime errors like stack overflow or infinite loops. It's best to avoid such circular dependencies and design your services in a more decoupled way to ensure proper functioning and maintainability. Otherwise, best way to go 👏🏼
@kurisutinahiyajosafinaillu6595 Жыл бұрын
I have a question about registering the repository and service, if i have multiple interfaces and classes in a same folder, how can i register them quickly without having to write multiple builder.Services.AddScoped like this example: builder.Services.AddScoped() builder.Services.AddScoped() ... builder.Services.AddScoped()
@HedgarBezerra2 жыл бұрын
I really like this pattern along with some more abstraction, in manner that we code a abstract class with generic parameter(class) with all data access functions, this could be reused for all entities around the application.
@thepatrickandlunashow2 жыл бұрын
Great video! Kristina recommended your podcasts- I am on board!
@andrewsotnikov5680 Жыл бұрын
Good example, it also touches the basics of DI
@chinmayck85095 ай бұрын
Well explained brother. Got to learn more than expected.
@AthelstanEngland Жыл бұрын
Thanks for this. Never really understood what bit the 'repository' was... now you say it is pretty much the service (I use same term) it makes more sense. One question if I may. Working on my first app of this type (OpenAPI) and it seems you do have to register every single interface in program.cs (using .NET 7) which seems a lot of overhead to me?
@sthreetorch Жыл бұрын
Point by point. Very well explained! Thanks a lot Man (Additional Subscriber)
@Gabrieldvg1 Жыл бұрын
Good video, but what is a service exactly in this context? I've seen it used in a few places but I still don't know what it is referred to :/
@10Totti2 жыл бұрын
Many thanks!
@PatrickGod2 жыл бұрын
You're welcome!
@adamm97062 жыл бұрын
Have you done the Factory Pattern? If not that would make for a great video as well
@ana-mariaolujic65705 ай бұрын
excellent explanation, thank You Patrick
@samiullah0011 Жыл бұрын
If have 50+ controllers and services should i need to inject every class(addscoped etc) into main class?
@jannickbreunis Жыл бұрын
I am studying how to create multiple data acces classes to prevent having one enormous data acces class. I found the Service Pattern and Repository Pattern. I guess with creating an interface, you combine the two? Good video and nice combination of also showing the depency injection.
@jd-chnl Жыл бұрын
Thank you for explaining! One thing I would like to comment is that your controller in the example works just like a wrapper and adds no any functionality, so I think there is no really need to implement repository here.
@byte79302 жыл бұрын
1. This looks exactly like your Udemy course I took a while ago. So I'm happy, that I'm already using it like this approach. 2. What game cardridge is inserted into your SNES? 😀
@PatrickGod2 жыл бұрын
1. Thank you so much for enrolling! 😊 2. The Legend of Zelda: A Link to the Past 🎮 Awesome you noticed!😁
@noahg2 Жыл бұрын
explained in the best possible manner, thank you very much.
@vdotrailers Жыл бұрын
what is Full repository analysis in AWS site and what does it do? can someone explain pls....is this the place where i can find my app source code in AWS?
@vintagewander2 жыл бұрын
You deserve more subscribers
@PatrickGod2 жыл бұрын
Thank you so much! I appreciate that. 😊
@StevenWong737 Жыл бұрын
Say if I have multiple interfaces and classes to be registered in the Program.cs, is there any way that I can do it with a smarter way instead of registering them one by one?
@ofskiiboy5 ай бұрын
You can use the Scrutor package which auto detects all your repo's and injects them
@Toughmenchannel Жыл бұрын
Great Video. Thanks a lot!
@phuongtran-qh5kq2 жыл бұрын
Sir, i have 1 question. What about dbcontext and dbset. For example: dbset User. Should i create a repository of user and inject that user db?
@salmanahmedkhan3979 Жыл бұрын
great. subscribed.
@PatrickGod Жыл бұрын
Awesome! Thank you!
@kwstaslalaounis3212 Жыл бұрын
Thank you very much!!!
@arunkumarsingh87542 жыл бұрын
Love from 🇮🇳 ❤
@kiransai76162 жыл бұрын
Good work sir 👍 , on your next vlog please explain us how to work on multi tenant architecture with identity. for example: if the client is registering he will have master data base and, he will add some worker's below him they have their own separate database.
@Untold-Stories5 ай бұрын
Hi Patric , Please clear the below issue I am facing. I am creating a GET request for search function. I am sending the whole model in GET. some of the properties in model is [required]. when I am sending the model the validation working. I don't want required validation for search operation. Is there any technique to remove the validation for GET Search method. Thanks.
@marcioalexandremarcondes557 Жыл бұрын
Tks!
@QartveliMamakaci20007 ай бұрын
Unknowingly explained Dependency Injection too lol.
@gmessias-dev2 жыл бұрын
Hello, I love your videos. I have a request because it still causes me a lot of doubt, could you make a video about websocket?
@tanujavalluru9195 Жыл бұрын
thankyou
@babarmughal8891 Жыл бұрын
Best
@tomchidwick5 ай бұрын
I'm still confused.
@Faygris Жыл бұрын
So, when using services like this, I've secretly been using the repository pattern all along? 🤯
@theonlycaulfield Жыл бұрын
No, this video perplexingly does not describe a repository pattern, as repositories are supposed to separate the db connection from the logic layer that is in the services/service layer. The author seems to be confused on this point when saying that he and others call the repository layer services. What he is doing is simply creating a service layer with the logic and db connection combined, which is what the repository pattern was created to prevent. The repo pattern is a common practice in enterprise software in the US, with both java spring and c# .net, where the intention is to isolate the db connection away from the service layer.
@yannid5456 Жыл бұрын
This explanation is a bit not so correct. Services and Repository are two different patterns that perform different tasks. We use service to store the business logic such conditions and data manipulations.The repository pattern is used for data operations such as database CRUD operations
@wilfredkane75692 жыл бұрын
𝘱𝘳𝘰𝘮𝘰𝘴𝘮
@mck95125 ай бұрын
Dude... im interested in an explanation of repository service, not DI. Stay on subject.