Code - github.com/CuriousDrive/BookStores Thanks for watching, please share with your friends :)
@johnn50194 жыл бұрын
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!
@CuriousDrive4 жыл бұрын
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.
@mysteriouspants60824 жыл бұрын
Thank you so much for another awesome video!!
@CuriousDrive4 жыл бұрын
Thanks Mysterious Panther. Like that handle.
@BenHayat4 жыл бұрын
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.
@CuriousDrive4 жыл бұрын
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
@BenHayat4 жыл бұрын
@@CuriousDrive My pleasure my friend. And I love your videos as well.
@CuriousDrive4 жыл бұрын
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 :)
@BenHayat4 жыл бұрын
@@CuriousDrive Send me an email, and I'll cover all the parts for you maybe later on when I get home. Ben@MicroIntelligence.Com
@CuriousDrive4 жыл бұрын
I would love to know your comments on this. kzbin.info/www/bejne/rZ61dmWhnrl3r7M
@talkathiriify4 жыл бұрын
Very Awesome Thank you very very much.
@yashvishah78002 жыл бұрын
Thank You Soo Much... It helped me a lot.. God Bless You.. :-)
@CuriousDrive2 жыл бұрын
Thanks Yashvi, Please share with your friends :)
@arunkumarsingh87544 жыл бұрын
Awesome
@CuriousDrive4 жыл бұрын
Isn't it mid-night in India :)
@arunkumarsingh87544 жыл бұрын
@@CuriousDrive yes it is
@MlySultan3 жыл бұрын
Great job thank you 👍
@CuriousDrive3 жыл бұрын
Thank you too!
@ondrejhadrava41094 жыл бұрын
If you could do something with the audio, it would be nice.. Anyway great tutorial, it helped me a lot!
@CuriousDrive4 жыл бұрын
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.
@nirankarkaushik95494 жыл бұрын
thanks a lot for providing such informative lecture..... it would be nice if gRPC used instead of REST API
@CuriousDrive4 жыл бұрын
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!!!
@samutsaritv68013 жыл бұрын
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
@CuriousDrive3 жыл бұрын
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.
@anuphosur5104 жыл бұрын
Can we use ObservableCollection instead of reloading the author collection after inserting the record?
@CuriousDrive4 жыл бұрын
that's actually a good idea. I have personally not tried but I am definitely going now and see if it works or not.
@chriswatts9234 жыл бұрын
@@CuriousDrive well..?
@13PRoman4 жыл бұрын
To resolve problem with calling GetJsonAsync method from class HttpClient, you should to go to NuGet and install blazor.httpclient(P.S include prerelease)
@CuriousDrive4 жыл бұрын
Thanks for mentioning that. I believe, I forgot to mention that in the video.
@CoderboyPB4 жыл бұрын
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.
@CuriousDrive4 жыл бұрын
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.
@CoderboyPB4 жыл бұрын
@@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 ...
@adedejiayodeji86294 жыл бұрын
Did anyone here face an issue while trying to GetById ? Keeps saying its not set to the instance of an object.
@narayanant84894 жыл бұрын
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.
@CuriousDrive4 жыл бұрын
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.
@mysteriouspants60824 жыл бұрын
Might as well go with Blazor as @Curious Drive is already teaching how to be a full stack Blazor developer :)
@talkathiriify4 жыл бұрын
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
@talkathiriify4 жыл бұрын
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.
@CuriousDrive4 жыл бұрын
I am glad that you figured it out.
@siyandakhanyile2104 жыл бұрын
I am still getting this error, how do I reference the package needed?
@talkathiriify4 жыл бұрын
@@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.
@siyandakhanyile2104 жыл бұрын
@@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-ot7fw4 жыл бұрын
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-ot7fw4 жыл бұрын
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?
@CuriousDrive4 жыл бұрын
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
@talkathiriify4 жыл бұрын
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.
@CuriousDrive4 жыл бұрын
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.
@talkathiriify4 жыл бұрын
@@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.
@mohscode2194 жыл бұрын
Please how do i add api key / request headers
@CuriousDrive4 жыл бұрын
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.
@reflextm21573 жыл бұрын
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!
@CuriousDrive3 жыл бұрын
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.
@reflextm21573 жыл бұрын
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.
@reflextm21573 жыл бұрын
@@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.
@reflextm21573 жыл бұрын
@@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 :)
@BarriDuty4 жыл бұрын
how can we manage http responses or status codes? in case something goes wrong in the api
@CuriousDrive4 жыл бұрын
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
@BarriDuty4 жыл бұрын
@@CuriousDrive thank you :)
@tomislavvalent31704 жыл бұрын
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