No video

Blazor Tutorial : Call REST API | CRUD Methods - EP10

  Рет қаралды 32,321

CuriousDrive: Solve Coding Problems & Win Prizes!

CuriousDrive: Solve Coding Problems & Win Prizes!

Күн бұрын

Пікірлер: 64
@CuriousDrive
@CuriousDrive 3 жыл бұрын
Code - github.com/CuriousDrive/BookStores Thanks for watching, please share with your friends :)
@johnn5019
@johnn5019 4 жыл бұрын
Well Done my Friend! These are very essential concepts; they are very relevant and valid and a MUST for all developers working on modern apps. Keep up the good work!
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Comments like yours keep me going :) My plan is to not show ads. So please share the videos with your friends and let's be part of the community.
@mysteriouspants6082
@mysteriouspants6082 4 жыл бұрын
Thank you so much for another awesome video!!
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Thanks Mysterious Panther. Like that handle.
@BenHayat
@BenHayat 4 жыл бұрын
Rather than using a single instance of HTTPClient, you should use HTTPClientFactory to manage ALL client instances properly without disposing them to exhaust the Socket. You create an HTTPService class to be injected where you want. This is in your startup services.AddHttpClient(); And in your service public class NotificationService { private readonly HttpClient _httpClient; public NotificationService(HttpClient httpClient) { _httpClient = httpClient; } This is then managed by HTTPClientFactory! Hope this helps.
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Love your feedback. 1st dark theme and now this. I am definitely gonna add this in one of my future videos. Again really appreciated your feedback. I hope I keep on getting them
@BenHayat
@BenHayat 4 жыл бұрын
@@CuriousDrive My pleasure my friend. And I love your videos as well.
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Hey Ben, Hope you are doing good. I am getting ready to make a demo on HTTPClientFactory like you suggested. I find so many articles on how I can use it to pull data but I don't find any example on how I can post data in API using HTTPClientFactory Do you know where I should look? Thanks & Happy new year :)
@BenHayat
@BenHayat 4 жыл бұрын
@@CuriousDrive Send me an email, and I'll cover all the parts for you maybe later on when I get home. Ben@MicroIntelligence.Com
@CuriousDrive
@CuriousDrive 4 жыл бұрын
I would love to know your comments on this. kzbin.info/www/bejne/rZ61dmWhnrl3r7M
@talkathiriify
@talkathiriify 4 жыл бұрын
Very Awesome Thank you very very much.
@yashvishah7800
@yashvishah7800 2 жыл бұрын
Thank You Soo Much... It helped me a lot.. God Bless You.. :-)
@CuriousDrive
@CuriousDrive 2 жыл бұрын
Thanks Yashvi, Please share with your friends :)
@arunkumarsingh8754
@arunkumarsingh8754 4 жыл бұрын
Awesome
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Isn't it mid-night in India :)
@arunkumarsingh8754
@arunkumarsingh8754 4 жыл бұрын
@@CuriousDrive yes it is
@MlySultan
@MlySultan 3 жыл бұрын
Great job thank you 👍
@CuriousDrive
@CuriousDrive 3 жыл бұрын
Thank you too!
@ondrejhadrava4109
@ondrejhadrava4109 4 жыл бұрын
If you could do something with the audio, it would be nice.. Anyway great tutorial, it helped me a lot!
@CuriousDrive
@CuriousDrive 4 жыл бұрын
I know. I have been experimenting with Adobe Premier to remove background noise but then my voice sounds like I am talking in some kind of pipe. Not sure how to fix this. Working on it. Thanks for the feedback though.
@nirankarkaushik9549
@nirankarkaushik9549 4 жыл бұрын
thanks a lot for providing such informative lecture..... it would be nice if gRPC used instead of REST API
@CuriousDrive
@CuriousDrive 4 жыл бұрын
That is really good point. gRPC does give 4 ways to stream data across applications. I am gonna create another series to explain all the possibilities. Stay tuned!!!
@samutsaritv6801
@samutsaritv6801 3 жыл бұрын
You should created a private method with the rest api uri and call it in your private load and oniitialized that's be better for DRY principle
@CuriousDrive
@CuriousDrive 3 жыл бұрын
Thanks Samut, I will keep that in mind for the future demos. It's just difficult to follow all best practices and show the main demo at the same time. I am working on it.
@anuphosur510
@anuphosur510 4 жыл бұрын
Can we use ObservableCollection instead of reloading the author collection after inserting the record?
@CuriousDrive
@CuriousDrive 4 жыл бұрын
that's actually a good idea. I have personally not tried but I am definitely going now and see if it works or not.
@chriswatts923
@chriswatts923 4 жыл бұрын
@@CuriousDrive well..?
@13PRoman
@13PRoman 4 жыл бұрын
To resolve problem with calling GetJsonAsync method from class HttpClient, you should to go to NuGet and install blazor.httpclient(P.S include prerelease)
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Thanks for mentioning that. I believe, I forgot to mention that in the video.
@CoderboyPB
@CoderboyPB 4 жыл бұрын
Where did you get the PostJsonAsync, PutJsonAsync, etc. Methods? They are not part of HttpClient. You need the microsoft.aspnetcore.blazor.httpclient Package which include these (Extension) Methods.
@CuriousDrive
@CuriousDrive 4 жыл бұрын
When I made this video, they were part of the HttpClient. I made another video explaining why you should HttpClientFactory instead. Please check that video here. Sorry about the confusion. kzbin.info/www/bejne/rZ61dmWhnrl3r7M I should just take down this video.
@CoderboyPB
@CoderboyPB 4 жыл бұрын
@@CuriousDrive WOW!!! It WAS part of HttpClient, and than they dropped it? Reminds me of that Database Connection Error which I was searching 6 hours for, when I reallized, that the SQL Server wasn't running, because MS changed that presetting. If I would have known that, I would have had fixed it in less than 5 minutes ...
@adedejiayodeji8629
@adedejiayodeji8629 4 жыл бұрын
Did anyone here face an issue while trying to GetById ? Keeps saying its not set to the instance of an object.
@narayanant8489
@narayanant8489 4 жыл бұрын
Hi Brother, i like your all videos. keep post. i am going to develop new Product (Web based) for my client. My product is little bit complex functionality. Could you suggest best technology for my product. like ASP.NET Core + Angular ASP.NET Core + Blazor and EF or ADO.NET or Dapper Advance Thanks. Waiting for your reply.
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Hi Narayanan, I am glad that you like the videos. :) Honestly, it depends on what you are comfortable with. I would look at the client requirements and research to see if there are solutions/documentation on the internet for all the requirements. Then go for that technology. Having said that, #Microsoft is investing a lot in #ASP.NET Core + #Blazor and it's going to be future of web development in #dotNET world. So if you want to learn and be part of that community #Blazor is the way to go. I haven't used #ADO.NET or #Dapper so I can't really comment on that. #EntityFramework Core makes life very easy though. I wish you good luck for your project and hope I answered your questions.
@mysteriouspants6082
@mysteriouspants6082 4 жыл бұрын
Might as well go with Blazor as @Curious Drive is already teaching how to be a full stack Blazor developer :)
@talkathiriify
@talkathiriify 4 жыл бұрын
Dear Fahad, I am following this logic to consume the API (also following you way for the api) but i get a compiler error saying 'HttpClient' dos not contain a definition for 'GetJsonAsync' and no accessible extension method 'GetJsonAsync' what should i do? I am using asp.net core 3.1 Thank you very much for your help
@talkathiriify
@talkathiriify 4 жыл бұрын
Please discard my question i followed your code in the github and found the solution by installing this package ;Microsoft.AspNetCore.Blazor.HttpClient' which is in preview stage. Thank you very mcuh.
@CuriousDrive
@CuriousDrive 4 жыл бұрын
I am glad that you figured it out.
@siyandakhanyile210
@siyandakhanyile210 4 жыл бұрын
I am still getting this error, how do I reference the package needed?
@talkathiriify
@talkathiriify 4 жыл бұрын
@@siyandakhanyile210 install this package Microsoft.AspNetCore.Blazor.HttpClient in your application. you have to check the preview when looking for this package in nuget because it is is in preview. I hope this helps you.
@siyandakhanyile210
@siyandakhanyile210 4 жыл бұрын
@@talkathiriify It Worked man. Thank you. Can I not create a separate c# class, and move all the code on the @code directive to that class and inherit as necessary?
@mp-ot7fw
@mp-ot7fw 4 жыл бұрын
Hi again, I have another quick question. I must have missed something. I added @inject HttpClient Http; in my Authors.razor page. Then, in my code for that page, instead of calling AuthorService.GetAuthors, I added Http.GetJsonAsync... My compiler is now complaining about 'The type or namespace name 'Http' could not be found. Evidently it does not recognize the injected HttpClient reference. My startup, under Configservices, has 'services.AddSingleton();' which uses the System.Net.Http; namespace. Any ideas on this? Thanks much!
@mp-ot7fw
@mp-ot7fw 4 жыл бұрын
OK so I see that there is a similar question below, I will try installing the Blazor.HTTPClient package. but How do I inject or reference that? With the same @inject HttpClient statement?
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Hello, I think you are trying to use httpclient in classic way. I suggest you to watch below video. I have mentioned disadvantages of directly using httpclient. kzbin.info/www/bejne/rZ61dmWhnrl3r7M
@talkathiriify
@talkathiriify 4 жыл бұрын
Thank you very much for all your efforts. I have a small question and i hope you please answer it. Know we hard coded the get,post,update... uri which is localhost/44394/api/ and so on, my question is when we deploy the application to for example my client server will this api still working or it will break since it is not local host and different port. Your answer will be highly appreciated. Thank you very much.
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Yes it will break because your server will look for API on it's machine. Domain of API is something people store it in appsettings and then access it from there. You will have to deploy your API on some machine and mention that machine name and port number in the appsettings.
@talkathiriify
@talkathiriify 4 жыл бұрын
@@CuriousDrive Thank you very much for your quick reply. Could you please put my hand to this hint since i am a new to web application, because all my experience on desktop application and i am now trying to move all my desktop applications to a blazor. Again thank you so much for your episodes i learned a lot from them.
@mohscode219
@mohscode219 4 жыл бұрын
Please how do i add api key / request headers
@CuriousDrive
@CuriousDrive 4 жыл бұрын
My next demo is on JWT and then I am going to make demo on blazor on how we can add values in headers to get the token.
@reflextm2157
@reflextm2157 3 жыл бұрын
I know it is a bit late for questions, but hopefully someone knows this issue... it seems to me that I have a problem connecting the Blazor Web App to the Api. There are many errors that can be seen in the error log of the dev tools. One of them ---"System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. -- System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure." - ---- "System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)" ---- and this is the second one. I dont know what I can change I implemented every possible way there is from your video and others. Great videos btw :D and keep up the great work!
@CuriousDrive
@CuriousDrive 3 жыл бұрын
I have not come across this message in the browser. It seems like something has to do with the SSL certificate. Did you install SSL certificate which comes out of the box when we create the project or you are using just http and not https for calling the web apis.
@reflextm2157
@reflextm2157 3 жыл бұрын
i am using https, it was the default for my api and my blazor project. I didnt know I had to install a ssl certificate. I still cant fix it.
@reflextm2157
@reflextm2157 3 жыл бұрын
@@CuriousDrive Is there any way that we could step in contact? Teams, Skype, Discord? So that you could maybe help me fix this issue. I have tried running the websites without a ssl certificate but it still doesn't work.
@reflextm2157
@reflextm2157 3 жыл бұрын
@@CuriousDrive I have fixed it, I had to move the Visual Studio certificate to the trusted folder... but thank you for your response your videos are amazing keep going :)
@BarriDuty
@BarriDuty 4 жыл бұрын
how can we manage http responses or status codes? in case something goes wrong in the api
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Excellent question. Singleton HttpClient can't handle that scenario. You will have to use IHttpClientFactory. you can find out more about it here. docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests
@BarriDuty
@BarriDuty 4 жыл бұрын
@@CuriousDrive thank you :)
@tomislavvalent3170
@tomislavvalent3170 4 жыл бұрын
With JSON.NET you can use JsonPropertyAttribute to change the names of properties when they are serialized to JSON. Hope this helps www.newtonsoft.com/json/help/html/JsonPropertyName.htm
@CuriousDrive
@CuriousDrive 4 жыл бұрын
Thanks, I didn't know about this.
Blazor Tutorial : Authentication | Out of the box - EP11
18:25
CuriousDrive: Solve Coding Problems & Win Prizes!
Рет қаралды 28 М.
Call REST API from ASP NET Core Blazor
9:58
kudvenkat
Рет қаралды 68 М.
小丑和白天使的比试。#天使 #小丑 #超人不会飞
00:51
超人不会飞
Рет қаралды 32 МЛН
Zombie Boy Saved My Life 💚
00:29
Alan Chikin Chow
Рет қаралды 33 МЛН
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 24 МЛН
КТО ЛЮБИТ ГРИБЫ?? #shorts
00:24
Паша Осадчий
Рет қаралды 4,3 МЛН
Consume REST API from Blazor WebAssembly
20:09
Roozbeh Shad
Рет қаралды 18 М.
Blazor Tutorial : Authentication | Custom AuthenticationStateProvider - EP12
29:46
CuriousDrive: Solve Coding Problems & Win Prizes!
Рет қаралды 63 М.
Blazor Consuming API
14:50
DavidSeesSharp
Рет қаралды 3,2 М.
Blazor : Basic CRUD Operation | Web API Calling | ASP.NET Core
18:57
Thumb IKR - Programming Examples
Рет қаралды 8 М.
Learn Blazor: Build an Inventory Management System in .NET 8
2:17:34
RESTful API with .NET Core (.NET 7) - Full Course for Beginners
2:32:39
DotNetMastery
Рет қаралды 184 М.
Blazor Tutorial : HttpClient | Login User - EP14
13:32
CuriousDrive: Solve Coding Problems & Win Prizes!
Рет қаралды 20 М.
小丑和白天使的比试。#天使 #小丑 #超人不会飞
00:51
超人不会飞
Рет қаралды 32 МЛН