ASP.NET Core MVC 2022 - 7. Dependency Injection + Repository Pattern

  Рет қаралды 25,806

Teddy Smith

Teddy Smith

Күн бұрын

Пікірлер: 48
@kylecollie7813
@kylecollie7813 2 жыл бұрын
Nice analogy with the restaurant buzzer for async. Good job!
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
Sweet thanks Kyle
@theroostingroaster1584
@theroostingroaster1584 Жыл бұрын
Man these tutorials are amazing, can't thank you enough Teddy.
@codegate615
@codegate615 2 жыл бұрын
I appreciated the refactoring lesson for DI/Repository pattern. Sometimes you skip over certain items without ever even briefly mentioning them such as why we use Scoped. Perhaps you'll go into it later, but I don't know that yet.
@datguy4104
@datguy4104 Жыл бұрын
AddScoped is an injection that's created only for that instance where it's called/injected and is garbage collected when it's no longer in use. The other option is singleton which is one instance used for all calls/injections.
@huynguyenluonggia6393
@huynguyenluonggia6393 Жыл бұрын
there are three types of dependency lifetime: transient, scope, and singleton. Transient for each handle, scoped for each HTTP request and singleton for all lifetime of application.
@stanleyjekwu6810
@stanleyjekwu6810 2 жыл бұрын
Thank you for what I'm learning from this series... I must complete this project. watching from Nigeria
@jftechdrones
@jftechdrones 5 ай бұрын
Thanks for the tutorials, have been very helpful so far! Died a little inside at 16:30 though lmao
@bjornhellgate3985
@bjornhellgate3985 22 күн бұрын
This has been a really good tutorial so far, but why does some of the Club description say "This is the description of the first cinema" instead of club? are we secretly making a cinema page?
@JFresh1977
@JFresh1977 2 жыл бұрын
Really enjoying this series. Can't wait for the next video! :)
@alzearafat
@alzearafat Жыл бұрын
Thank you so much, really helpful for beginners like me
@liferunner_ua
@liferunner_ua Жыл бұрын
This simply should be liked for how you laugh on copy-paste programming temptation at 19:25
@MyAutist
@MyAutist Жыл бұрын
Teddy, i my opinion, the MVC architecture reveals all the migty of interfaces. It often seems that there is no need in them untill you come acros this kind of projects... You define inteface, like You did here, then implement mock class for debug reson, then implement real data-oriented class and finaly, in one short string of code like "servies.AddTransient()", changing only one word (implementation) You change the whole behavior of your project! Isn't it amazin?! And thank You for yout series once more!
@TeddySmithDev
@TeddySmithDev Жыл бұрын
I wish interfaces were used more outside C#/Java because the power is insane. The most amazing part of programming is that we get paid 100K to do the job when it is so fun and easy lol
@MyAutist
@MyAutist Жыл бұрын
@@TeddySmithDev No shit, bro! )))
@BenjaminBrienen
@BenjaminBrienen Жыл бұрын
@@TeddySmithDev Sometimes interfaces are just called something else, like in Rust they are called "traits".
@kvelez
@kvelez 6 ай бұрын
great use of async await
@hachiq2154
@hachiq2154 Жыл бұрын
Thanks for that) I wanna ask what is the point to make actions Task? Why don't just leave them IActionResult
@TeddySmithDev
@TeddySmithDev Жыл бұрын
Task makes it async. Async basically means more speed because it can run more then once chunk of code at a time.
@hachiq2154
@hachiq2154 Жыл бұрын
@@TeddySmithDev oh, thx, got it
@1Eagler
@1Eagler Жыл бұрын
06:00 I prefer returning a tuple T
@TeddySmithDev
@TeddySmithDev Жыл бұрын
You could return an object you created and populate with your own data. Tuple works great too. Go with your instinct!
@abdumannonnorboyev4025
@abdumannonnorboyev4025 6 ай бұрын
thank you for lesson
@1Eagler
@1Eagler Жыл бұрын
Why having one file per interface? I prefer having them in one file so a) I have one file open and b) I can find easily with the dropdown. Same with classes.
@TheAndyCooperz
@TheAndyCooperz 11 ай бұрын
What's your opinion on separating your project into multiple solutions e.g. Hosting, Core and Persistence? Also, you copied all the code from one interface to another, what is your opinion on having a base interface with definitions that are shared amongst many repositories then in your repository interfaces having definitions that are specific to each repository? Great videos by the way :)
@TeddySmithDev
@TeddySmithDev 11 ай бұрын
I'm not really a fan of multiple solutions (personal choice), but for huge projects it's a must i think. Base interfaces can be great actually. People call them a design flaw but they work well when you are just using regular CRUD. Thanks for the comment!
@kishorl7190
@kishorl7190 8 ай бұрын
Can you tell me why we need this pattern , it's so confusing
@huynguyenluonggia6393
@huynguyenluonggia6393 Жыл бұрын
hello everyone, for this project, I want to add a folder named Service can I add services that I use?
@siemkagospodarzu967
@siemkagospodarzu967 9 ай бұрын
Can you explain why the hell are you creating interfaces instead of just putting these methods to these repository classes? Interface is useful when you use it in multiple classes.
@TeddySmithDev
@TeddySmithDev 9 ай бұрын
You’re right but no using an interface would cause down votes and people to leave. Not using interface on class is not “cool” lol
@boky7731
@boky7731 8 ай бұрын
Because he is trying to teach the pattern that is widely used in the industry, on this example that is perfect for that
@siemkagospodarzu967
@siemkagospodarzu967 8 ай бұрын
@@boky7731 So you are wrong because this is not good example to use interface. And I say this as someone who has been working in this industry for several years.
@xavrock1112
@xavrock1112 Жыл бұрын
Hi. In 10:13 Why didn't you use SaveChanges ?
@huynguyenluonggia6393
@huynguyenluonggia6393 Жыл бұрын
you can use it directly in other methods or follow him
@tlhsieh4803
@tlhsieh4803 Жыл бұрын
Good video. Could I know the difference between "_context.Add(club);" and "_context.Club.Add(club);" ?
@huynguyenluonggia6393
@huynguyenluonggia6393 Жыл бұрын
so different, _context is an instance of class ApplicationDBContext. This class has a property named Clubs, which is a table in the relational database. So command _context. Clubs to access table Clubs in database and _context.Add() is wrong
@codegate615
@codegate615 2 жыл бұрын
Why did we make the Get code in the Interfaces Task?
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
Watch my interface video
@mohamedal-qadeery6530
@mohamedal-qadeery6530 2 жыл бұрын
@@TeddySmithDev why we didn't add Task in crud methods Add,update,delete,save ?
@nederlandshiphop
@nederlandshiphop Жыл бұрын
@@mohamedal-qadeery6530 probably because its not async funtion :)
@rishavmehta6198
@rishavmehta6198 2 жыл бұрын
Hello can you make a video on jwt auth with refresh jwt token and roles in web api?
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
Im busy with MVC right now but I'll get around to it.
@hackerw2
@hackerw2 Жыл бұрын
your video was super helpful just a small criticism and I am saying this in the most friendly way possible so please don't take this personally just work a little more on your typing because you typed the wrong characters way too much I think the main reason is you look at your keyboard when you type which will result in you not knowing if you are typing wrong or not and will result in distraction from the main topic Thank you again for the time you took to make this video
@TeddySmithDev
@TeddySmithDev Жыл бұрын
Zero offense taken lol. This is something I will look into.
@wesamhuseein7952
@wesamhuseein7952 Жыл бұрын
your videos are to long
@TeddySmithDev
@TeddySmithDev Жыл бұрын
many people suggested to shorten videos so I keep them 10 mins now 👌
@wesamhuseein7952
@wesamhuseein7952 Жыл бұрын
👍👍
@jul.ia.mou65416
@jul.ia.mou65416 Жыл бұрын
@@TeddySmithDev I would watch a ten hour video of you coding, you have no idea of how much your channel has been helping me
ASP.NET Core MVC 2022 - 8. CREATE [PART 1]
20:39
Teddy Smith
Рет қаралды 19 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 866 М.
SISTER EXPOSED MY MAGIC @Whoispelagheya
00:45
MasomkaMagic
Рет қаралды 19 МЛН
НАШЛА ДЕНЬГИ🙀@VERONIKAborsch
00:38
МишАня
Рет қаралды 3,3 МЛН
Dependency Injection in .NET Core (.NET 6)
1:00:32
IAmTimCorey
Рет қаралды 193 М.
ASP.NET Core MVC 2022 - 6. Detail Page
15:59
Teddy Smith
Рет қаралды 23 М.
Step by Step - Repository Pattern and Unit of Work with Asp.Net Core 5
1:29:51
ASP.NET Core MVC 2022 - 5. Views
19:19
Teddy Smith
Рет қаралды 35 М.
30 Programming Truths I know at 30 that I Wish I Knew at 20
17:41
Full CRUD Operations in Asp Net Core MVC using Entity Framework Core with Repository Pattern
1:24:04
𝐂𝐨𝐝𝐞𝐖𝐢𝐭𝐡𝐆𝐨𝐩𝐢
Рет қаралды 24 М.
What is Dependency Injection in .NET?
7:31
DotNetMastery
Рет қаралды 26 М.