ASP.NET Core Web API - 5. Repository Pattern & Dependency Injection Explained

  Рет қаралды 78,711

Teddy Smith

Teddy Smith

Күн бұрын

Пікірлер: 68
@hardcorecode
@hardcorecode Жыл бұрын
for larger projects its Controller -> Services -> Repositories
@elchinmirzayev7631
@elchinmirzayev7631 5 ай бұрын
service instead of interface?
@xlizer1_18
@xlizer1_18 Ай бұрын
@@elchinmirzayev7631 Services will be there anyways, so its more like this: Controller -> Services -> Repositories -> Interface
@afelixalves
@afelixalves 2 жыл бұрын
Great tutorial! Nice advanced (and correct) structure made simple. With so many bad approaches to API tuturials out there, this is the one to follow! Keep the great work and thanks for sharing it...
@hafidazer1634
@hafidazer1634 9 ай бұрын
This one was abit rough but got the 'get' call working, I guess I have to watch the video few more times to understand the details and again thank you very much Teddy for taking the time to make such great content. Looking forward to the other videos of this series. God bless
@TeddySmithDev
@TeddySmithDev 9 ай бұрын
Yoooo thank you for your time!
@lofto8363
@lofto8363 Жыл бұрын
i don't know what i am doing, but im lovin it
@TeddySmithDev
@TeddySmithDev Жыл бұрын
Lmao same
@kirillzlobin7135
@kirillzlobin7135 9 ай бұрын
10:37 IMPORTANT INFO. Services explained
@SamuelFatunmbi
@SamuelFatunmbi Жыл бұрын
Thank you very very much, Teddy. I love the way you teach.
@abdulmlaikalomayri727
@abdulmlaikalomayri727 Жыл бұрын
As always great videos from teddy smith. Thank you so much.
@FoxFireImr
@FoxFireImr 2 жыл бұрын
Thank you, you're really darn great. I look forward to seeing the rest of your videos :)
@bozios4663
@bozios4663 3 ай бұрын
For everyone that had swagger freez but end point was working check if "[ProducesResponseType(200,Type = typeof(IEnumerable))]" is correct
@josephh8117
@josephh8117 8 ай бұрын
good explanation of decoupled code. thanks t
@IliaFridland
@IliaFridland Ай бұрын
You are the best
@boopfer387
@boopfer387 Жыл бұрын
8:45 you say an ICollection is only read only - I believe you are referring to IEnumerable, ICollection you can add / remove but only to the end. IList has index so edit anyplace.
@TeddySmithDev
@TeddySmithDev Жыл бұрын
Did not know that. Thank you for commenting.
@monat_son
@monat_son Жыл бұрын
thanks Teddy, quality content!
@tbam21-12
@tbam21-12 6 ай бұрын
Fun fact, if your scrolling down because it's not working when you click run. Don't forget to build your solution first.
@kaydenangel3742
@kaydenangel3742 2 жыл бұрын
Heish man you are the best👏👏
@moviesexplainermarathi6753
@moviesexplainermarathi6753 7 ай бұрын
Love your videos brother
@TeddySmithDev
@TeddySmithDev 7 ай бұрын
Thank you 🙏
@leafmagi2796
@leafmagi2796 2 жыл бұрын
you really care the plural form of pokemon! Actually the full name is pocket monster, maybe the plural form is pokcet monsters :D
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
The official Pokémon master has spoken.
@HamzaDarouzi
@HamzaDarouzi Жыл бұрын
it's really great !
@raggardy
@raggardy 2 жыл бұрын
Hi Teddy. With IEnumerable and ICollection, can you use either or is it convention to use one and stick with it? Cheers
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
Use IEnumerable when you need to filter data. ICollection has more features like .length and CRUD actions.
@GrowmieTilman
@GrowmieTilman Жыл бұрын
Hey Teddy, thank you so much for this Tutorial. As an Software Developer that is familiar with the basic concepts of things like DI etc. it is easy to follow. I could imagine, that it could be hard to follow, if you dont have that background knowledge. Maybe you could link Videos that go a little deeper in that concepts in the sections. :) Greets Tilman
@TeddySmithDev
@TeddySmithDev Жыл бұрын
I made new blog posts on the topic, but my next course that I’m releasing will explain these topics better. Thanks for watching!
@eihabelbrgaty8909
@eihabelbrgaty8909 Жыл бұрын
Hi Teddy Million thanks for this tutorials ... I stack with ModelState Error does not exist in the current context
@yugant
@yugant Жыл бұрын
i was stuck at the same issue . Your controller needs to inherit from ApiController (or Controller) . public class PokemonController : ControllerBase
@supa_space
@supa_space Жыл бұрын
@@yugant Thank you for this tip, I was stuck here for hours😂
@Raj_Vishwa1
@Raj_Vishwa1 Жыл бұрын
Error : Showing in Swagger : No Operations defined in spec!
@oanaghicajanucristina
@oanaghicajanucristina Жыл бұрын
great videos! Liked and subscribed, but i have a question. Why did you use mapper? why you did not use logger? and why you didn't use service classes?
@TeddySmithDev
@TeddySmithDev Жыл бұрын
I’ve always found that going the extra and creating your own mappers can save time because you never have to debug them and can always easily change to meet needs
@etiel
@etiel 2 жыл бұрын
Do you use reshaper? It's very nice when it's ghosting the completion for you
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
No but I'll check it out. Resharper is on my to do list of things to do. Thanks for suggestion.
@MuhammadZharifMohdFuad
@MuhammadZharifMohdFuad 8 ай бұрын
Hi Sir, I am getting this error. System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: WebAPI.Interfaces.IOrderHeaderRepository Lifetime: Scoped ImplementationType: WebAPI.Repository.OrderHeaderRepository': Unable to resolve service for type 'WebAPI.Data.DataContext' while attempting to activate 'WebAPI.Repository.OrderHeaderRepository'.)' Please help
@parthsavliya4441
@parthsavliya4441 2 жыл бұрын
God !
@junlapunete1602
@junlapunete1602 2 жыл бұрын
Can I ask what font are you using?
@omerucansu2569
@omerucansu2569 Жыл бұрын
Hi sir, Why don't you use the async method
@TeddySmithDev
@TeddySmithDev Жыл бұрын
No real reason. Just didn’t add it at the time.
@patoledavid
@patoledavid 8 ай бұрын
Hi Teddy, I'm trying this video today and I'm getting a 404 Undocumented Error: Not Found in the place where you see the all the Pokemon. All other server responses look to be correct. Would you have an idea on where I could be going wrong? Thanks in advance!
@henrik3098
@henrik3098 Жыл бұрын
thanks man
@TeddySmithDev
@TeddySmithDev Жыл бұрын
No prob thanks for watching and commenting 👍
@AlThePal78
@AlThePal78 2 жыл бұрын
Do you use this pattern a lot I was told .NET was a repository pattern or something like that so why do this ? what you think about that
@mark63424able
@mark63424able Жыл бұрын
.NET is a software framework
@alidahud337
@alidahud337 Жыл бұрын
​ @Teddy Smith Hi, if it doesn't give me the contents of the database, what should I do? it's giving me back: id: 0 articletext: "string" etc.
@TeddySmithDev
@TeddySmithDev Жыл бұрын
That is strange. Maybe you are using method with no default ie. first() and not firstOrDefault()?
@alidahud337
@alidahud337 Жыл бұрын
@@TeddySmithDev Where?
@alidahud337
@alidahud337 Жыл бұрын
@@TeddySmithDev even though i successfully seeded some data into the DB
@alidahud337
@alidahud337 Жыл бұрын
@@TeddySmithDev I found my issue but now another error: System.FormatException: String 'FalseData Source=DESKTOP-HGUF4HF' was not recognized as a valid Boolean., Which is inside of my connection string, but this statement raises the error: return _context.qbitArticles.OrderBy(q=>q.id).ToList();
@evilsanta8585
@evilsanta8585 Жыл бұрын
So youre bringing in the entire databse in. isn't that slower when the database becomes huge
@TeddySmithDev
@TeddySmithDev Жыл бұрын
Ef Core only builds SQL queries and doesn’t really bring any data besides what you ask
@baileymorgan9986
@baileymorgan9986 2 жыл бұрын
I am getting a CORS error when completing this video. Unsure why as I am not using CORS yet. Any ideas? I have tried multiple browsers.
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
You need to turn cors off explicitly. Look at my GitHub for examples.
@baileymorgan9986
@baileymorgan9986 2 жыл бұрын
@@TeddySmithDev No where in your github (for this project) do I see references to cors. I am not turning it on explicitly so I am not sure how to turn it off explicitly
@sylgeekhome
@sylgeekhome 11 ай бұрын
Why pokemon not called pokemons inside dbset?
@TeddySmithDev
@TeddySmithDev 11 ай бұрын
This is the debate of the century lmao. What is the true plural form of Pokémon??? 🤣
@michaelkline8168
@michaelkline8168 2 ай бұрын
How do we find your discord?
@yusufkaandemirbas4451
@yusufkaandemirbas4451 Жыл бұрын
Is it an entry level course? By brain blowed up
@TeddySmithDev
@TeddySmithDev Жыл бұрын
May want to check intro to C# video series on my homepage
@rifathossain328
@rifathossain328 Жыл бұрын
i know OOP but i am getting lost here kinda confusing .
@yassir-eh
@yassir-eh Жыл бұрын
me too man me too
@Shadowplayification
@Shadowplayification 2 жыл бұрын
I'm a little late to the party, I know, but when i try to run my code, I get this Exception: System.InvalidOperationException: 'Action 'PokemonReviewApp.Controllers.PokemonController.GetPokemons (PokemonReviewApp)' does not have an attribute route. Action methods on controllers annotated with ApiControllerAttribute must be attribute routed.' What can I do to fix this?
@Shadowplayification
@Shadowplayification 2 жыл бұрын
The Exception gets thrown at app.MapControllers(); in the Program.cs class.
@TeddySmithDev
@TeddySmithDev 2 жыл бұрын
You might need to check to see if controller annotation is in your controller code
@juricamihin7524
@juricamihin7524 Жыл бұрын
just add using RouteAttribute = Microsoft.AspNetCore.Mvc.RouteAttribute;
ASP.NET Core Web API - 6. GET & Read Methods [PART 1]
36:24
Teddy Smith
Рет қаралды 65 М.
ASP.NET Core Web API - 8. GET & Read Methods [PART 3]
48:54
Teddy Smith
Рет қаралды 25 М.
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,2 МЛН
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 102 МЛН
Implementing JWT Authentication in ASP.NET Core
23:51
Nick Chapsas
Рет қаралды 39 М.
.NET and C# are in trouble. Here is what I'd do.
10:57
Ed Andersen
Рет қаралды 98 М.
Understand your C# queries! IEnumerable & IQueryable in explained
11:28
tutorialsEU - C#
Рет қаралды 39 М.
Dependency Injection
45:17
Microsoft Visual Studio
Рет қаралды 147 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 250 М.
How Dependency Injection Works in #csharp
43:52
Raw Coding
Рет қаралды 55 М.
Forget Controllers and Minimal APIs in .NET!
14:07
Nick Chapsas
Рет қаралды 75 М.
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,2 МЛН