WebAPI Improvements in .NET 5 - OpenAPI, Better F5, and NSwag

  Рет қаралды 99,748

IAmTimCorey

IAmTimCorey

Күн бұрын

In .NET 5, WebAPI has an important quality of life upgrade. In this video, we are going to look at the integration of OpenAPI into the project, how it works, and then why it is so important. We will also look briefly at NSwag and how to use it to generate API clients for our other applications using OpenAPI.
Source Code: leadmagnets.app/?Resource=Web...
Mailing List: signup.iamtimcorey.com/
Purchase courses: www.iamtimcorey.com
0:00 - Intro
0:56 - OpenAPI: Building ASP .NET Core Web API app
3:53 - Demo App overview: configuration
8:13 - Demo App overview: OpenAPI with Swagger
14:07 - swagger.json
15:48 - Using swagger.json in Blazor Web Assembly App:
18:35 - • Connected services: Swagger Client
21:28 - • Connecting to OpenAPI
27:29 - • CORS policy exception explained
30:00 - • OpenAPI: Add CORS
33:59 - NSwag generated code
37:01 - Connecting to OpenAPi from console app
43:32 - Note on HttpClienet
44:38 - Summary and concluding remarks
Thanks to Ralfs HBK for the chapter breakdown

Пікірлер: 162
@STUPIDYOUTUBE_HIDINGMSGS
@STUPIDYOUTUBE_HIDINGMSGS 2 жыл бұрын
I'm just starting to catch up with .net 5 and 6, and this is an amazing learning article to start with, thank you for the great details you put in this, Tim, and the easy-to-understand examples you are creating. As always, your channel is one of my go-to YT channel to learn new stuff in C#/.Net. cheers
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
I am glad it was helpful.
@TonoNamnum
@TonoNamnum 3 жыл бұрын
Last example where you use a console application is great for understanding. Thanks Tim!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad it was helpful!
@twotime5430
@twotime5430 3 жыл бұрын
Wow Tim, this was great!!! Exactly, what I was looking for!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad to hear it
@jwalkerjr
@jwalkerjr 3 жыл бұрын
Great job, Tim. Love it. Very informative. Kind of reminds me of good old XSD-generated code. There's always the good and the bad. As you mentioned, with proper API versioning, this kind of thing can be managed, and I, for one, always appreciate a contract.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thanks for sharing
@zulhishamtan4308
@zulhishamtan4308 3 жыл бұрын
Thanks Tim, great stuff. And awesome explanation. Awaiting for the authentication/authorization video.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You are welcome.
@AnthonyGriggs
@AnthonyGriggs 3 жыл бұрын
@@IAmTimCorey I second that, awesome video... love the Blazor app demo coupled in as well. If you get a chance I would love your take on adding authentication in the Web API using Asp.Net Core Identity.
@ahmedjalalmalik4603
@ahmedjalalmalik4603 3 жыл бұрын
@IAmTimCorey I loved the way to explain things. I am waiting for your tutorial on microservices with docker.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thanks!
@expertreviews1112
@expertreviews1112 3 жыл бұрын
As always, awesome content Tim!!!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thanks!
@yohanesjohn99
@yohanesjohn99 3 жыл бұрын
Wew! This is great tutorial! so easily to catch up even for beginners for me
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad it was helpful!
@emmanuel2842
@emmanuel2842 3 жыл бұрын
Doing great Tim.. The really cool stuff I learnt was Paste JSON As Classes 😍😍... Looking forward to your Blazor series with Authorization (of components) and Authentication (of users) using OpenApi
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad it was helpful.
@jpchauny108
@jpchauny108 3 жыл бұрын
Great tutorial. Thank you !
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You are welcome!
@RalfsBalodis
@RalfsBalodis 3 жыл бұрын
0:00 - Intro 0:56 - OpenAPI: Building ASP .NET Core Web API app 3:53 - Demo App overview: configuration 8:13 - Demo App overview: OpenAPI with Swagger 14:07 - swagger.json 15:48 - Using swagger.json in Blazor Web Assembly App: 18:35 - • Connected services: Swagger Client 21:28 - • Connecting to OpenAPI 27:29 - • CORS policy exception explained 30:00 - • OpenAPI: Add CORS 33:59 - NSwag generated code 37:01 - Connecting to OpenAPi from console app 43:32 - Note on HttpClienet 44:38 - Summary and concluding remarks
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thank you! Posted.
@x_salaheddinechannel_x
@x_salaheddinechannel_x 3 жыл бұрын
Thank you Tim Corey for this video, and we need video for Xamarin android. Thanks and best Regards.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You are welcome.
@viktoralferov2874
@viktoralferov2874 3 жыл бұрын
greetings. thank you. very informative and useful
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad it was helpful!
@jamesbest2221
@jamesbest2221 3 жыл бұрын
Awesome! Thank you!!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You're welcome!
@sheikhbashar1
@sheikhbashar1 3 жыл бұрын
Greate tutorial, thank you so much
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You're very welcome!
@zoltan.halasz
@zoltan.halasz 3 жыл бұрын
I can see there are improvements in .net core. More and more features added. I hope I can catch up one day 😊
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Yes, definitely
@smatveev
@smatveev 3 жыл бұрын
Very useful. Thanks a lot
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You are welcome.
@kevingates5851
@kevingates5851 3 жыл бұрын
Hi Tim, how does the Connected Service work with your other videos of Display___Model? Like how would you use something like this, then later add data annotations? Or is this better mainly for displaying records that won't be edited?
@StudentCompanion
@StudentCompanion 3 жыл бұрын
Great stuff! this is really wonderful and highly appreciated.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad it was helpful!
@jimwright9021
@jimwright9021 3 жыл бұрын
In VS 16.8.3 there is a separate template item in the first list for Web API as opposed to choosing Web Application, choose ASP.NET Core Web API
@ibrahimhussain3248
@ibrahimhussain3248 3 жыл бұрын
Nice 👍👍👍 Btw... I figured out how to make pluggable apps with C#. I already knew interfaces and reflection so I just had to figure out the project structure. I would like to see a tutorial on it though
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I will add it to the list. Thanks for the suggestion.
@amirhosseinbagheri824
@amirhosseinbagheri824 3 жыл бұрын
Hey Tim Thanks for uploading this video. Have you found a way to read the response headers?
@PyaePhyoAung-xi9fh
@PyaePhyoAung-xi9fh 3 жыл бұрын
Thank you, sir.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Thanks for trusting Tim with your trsaining.
@Ahmedhosnybarbary
@Ahmedhosnybarbary 3 жыл бұрын
Excellent
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thanks!
@MathieuMarchant
@MathieuMarchant 3 жыл бұрын
Thanks for the video Tim. It would also be interesting to know how to add what the "OpenAPI" checkbox does, manually. What if you already have a project created with the box unchecked or start from another template like the ASP.NET Core template with React client in there. Probably it is not too much work. I'll generate a new project like that and see what the changes are.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Please share what you find
@embossCoder
@embossCoder 3 жыл бұрын
Thank you
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Thank you for being part of the community!
@chaitusunkara
@chaitusunkara 3 жыл бұрын
Swagger allows documenting of APIs a bit easier and therefore when you want to give the definition of the API to others (not necessarily for creating client object), it’s a good way to understand the inputs, outputs etc.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Good Tip!
@HungTran-jx2xc
@HungTran-jx2xc 3 жыл бұрын
Thank you Tim, can you go deeper on topic generated client, please. Such as, intergrared authentication, availabe/limited data model binding(from a generated client's request to api controller). Why the generated client is using newtonsoft, where dotnet core system.text.json library?
@UzairAli001
@UzairAli001 3 жыл бұрын
I would also like to see in depth tutorial for NSwagger
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I will add it to the list. Thanks for the suggestion.
@dwightstevenpadilla6483
@dwightstevenpadilla6483 2 жыл бұрын
Sorry this might be out of the topic, but is it possible to have callback handler like nodejs inside api controller with void return type method instead of using iaction return types?
@TheMiamiVice27
@TheMiamiVice27 3 жыл бұрын
Hello Tim! Great video as usual. I have one question. We use Odata extensively in our API projects. Is there a way to generate OData service specification (like swagger.json in this video) and then use it config file,or shall I say, schema description, to generate a client for instance in Angular (JS) client app ? Or even better, is there a way to use swagger to generate OData service schema(description) ?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I'm not sure about that.
@chintu2691994
@chintu2691994 3 жыл бұрын
Hey, @IAmTimCorey do you make videos for angular if not then please start making them... I love the way you code and the way you explain.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
We appreciate the suggestion and I have added it to Tim's list.
@nikhil-ns5jn
@nikhil-ns5jn 3 жыл бұрын
this tutorial is really helpful can you please make a video on Azure pipelines
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Check out these videos - kzfaq.infosearch?query=devops
@arturkyulyan
@arturkyulyan 3 жыл бұрын
Thanks for tutorial. What if we do some changes in Web API project (like adding new action) and we need these changes to be adopted in the client projects? Do we need to repeat the same steps to update auto-generated C# code? Thanks.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Yes, but typically you do not want to change production API code like that. This is why we have versions. Otherwise, you would break all of your clients, some of which you may not control.
@nagasreekakubal3897
@nagasreekakubal3897 3 жыл бұрын
Hi Tim, I am getting "Not found" error when one webAPI calling another WebAPI and both are hosted in IIS as applications under Default Web Site. I am able to run and test them individually without any issues using postman. It works fine in debug mode too. I even tried adding Cors. Could you please point me to the right direction?
@upcsatx
@upcsatx 3 жыл бұрын
Great video! At 32:42 do you see any issue with setting builder.WithOrigins("*") if I'm OK with everyone being able to GET things?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
That would be fine.
@Christobanistan
@Christobanistan 3 жыл бұрын
Tim, I was wondering if you've seen the SwitchStartupProject VS extension? It allows you set up a very simple json file with various project combinations you can select from in the VS UI, in a combobox. When you select one, it sets multiple startup projects instantly. I find it ridiculously useful! Additionally, I have an extension called MVVM Tools that will switch between Views and ViewModels instantly (C# or VB only) by pressing Ctrl+E,Q. It uses class naming conventions and optional per-project configurations which you can set up in Options | MVVM Tools.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Interesting! Thanks for the tips.
@danielvillalba4457
@danielvillalba4457 3 жыл бұрын
Hi, great video as always, just small doubt, what about if we want to use dependency injection to provide the 'swaggerClient' class instead of use the new operator, is the OpenAPI provides with an interface or do we have to register the class directly ? Thanks a lot in advance Regards Daniel
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You can tell it to generate an interface as well.
@wayahedia9989
@wayahedia9989 3 жыл бұрын
I didn't understand it.. but I enjoyed it. !
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Practice what you see. It will help you grasp the concepts. That's what I do.
@wayahedia9989
@wayahedia9989 3 жыл бұрын
@@IAmTimCorey agree! I am a desktop/embedded developer and haven't done a lot of web stuff. Save for a few PHP sites in 2009. I am on a path to find out how to , or if I can control HID and BLE devices from a browser. I'd like to surprise my client with a browser version of some of the features of the app I am developing.
@haizzengunn9350
@haizzengunn9350 3 жыл бұрын
nice
@troymitchel4790
@troymitchel4790 3 жыл бұрын
Great stuff! Do you think you could create a course with WebAPI and React?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Not sure about React. I've got a ways to go before I get into JavaScript frameworks.
@JohnPeter-yf5jf
@JohnPeter-yf5jf 3 жыл бұрын
Maybe blazer?
@jo0h4n18
@jo0h4n18 3 жыл бұрын
@@JohnPeter-yf5jf Tim has a lot of Blazor videos for you to check out
@Denny093
@Denny093 3 жыл бұрын
When I try to add connection service with the swagger.json on build it says Not compiled in the WPF Project, but it doesn't throw any error. Switching in te "build and run" settings from minimal to diagnostinc on verbosity i found that the error is about swaggerClient not found in namespace. to be clear I have created a WPF .NET 5 app so there should be no compatibility problems. Anyone know how to fix?
@BT-de4wl
@BT-de4wl 3 жыл бұрын
I had the same issue, my mistake was when I was adding connected services I was adding it in the wrong solution. He's working with two solutions and adds connected services to "BlazorWasmDemo" . I did it on the wrong solution and got the same error. Just start again from the 18:40 mark and use the other solution and see if that helps!
@kevingates5851
@kevingates5851 3 жыл бұрын
Hi Tim, Do you have a video or suggestion resource about how to implement versioning wisely? I have found the [ApiVersion] data annotation as a concept, but I'm personally having a hard time finding documentation for .Net 5. I may not be searching the right terms, but I'd love to learn. Or if you have a paid course touching on this, please let me know. Thank you very much!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I haven’t covered it yet but it is a priority to cover.
@feelingeverfine
@feelingeverfine 3 жыл бұрын
Will you go over (1) how to generate openapi client without Visual Studio (for Mac users) and (2) NSwag.MSBuild on auto generating clients?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Nope, I'm not going that deep. I'm just introducing the topic. I may go deeper in another video.
@MultiLeechCZ
@MultiLeechCZ 3 жыл бұрын
What i would like to see gRPC-Web as connected service with WASM tutorial. :) Also how did u make this new( baseurl: "") thing ? i mean how is that baseurl showing automatically in the call ? Normally it is not happening
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I noted your recommendation and have added to my list, thanks.
@andywalter7426
@andywalter7426 3 жыл бұрын
One suggestion of one topic i would love to have covered is web api with ssl when not using localhost. An example can be if your local ip address is 192.168.0.150 and you want to use ssl, then would still work. The purpose of this would be to be able to test with other computers on your network before submitting to azure or other web hosting. Currently only localhost works out of the box. However, obviously, somebody else on your network cannot access the page. Can be good for testing with multiple users before publishing a site.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You can open up your firewall and publish your IISExpress URL locally so that people can access it and test against it.
@jamesbest2221
@jamesbest2221 3 жыл бұрын
p.s. I second Troy Mitchel's request for a course with WebAPI and React?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thanks for the vote.
@kevincordell9539
@kevincordell9539 3 жыл бұрын
@@IAmTimCorey I would rather see Angular than React :-)
@parko1965
@parko1965 3 жыл бұрын
Blazor Wasm, it's new, that's my opinion.
@yusufdm5472
@yusufdm5472 3 жыл бұрын
Hi Tim, nice tutorial. Is NSwag is doing same thing to Web APIs as what WSDL.exe used to do to build proxy classes for web services?
@TheMiamiVice27
@TheMiamiVice27 3 жыл бұрын
I would say it that they are equivalent. Web services (.asmx or WCF) are XML based, while Swagger is JSON based, without getting in the details ofc.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
It is a similar concept, yes.
@AndrewsVideosOnUTube
@AndrewsVideosOnUTube 3 жыл бұрын
If you get a build error when you use Connected Services to create the Swagger Client, make sure that you are using the latest NSwag.ApiDescription.Client NuGet package. That fixed my error.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Excellent Tip! Thanks for sharing.
@hugogogo13
@hugogogo13 3 жыл бұрын
Thank you for the presentation. Basically it's .Net Core 3 with swagger already installed. I was expecting more out of it tbh.. Especially because generated code usually makes inefficient solution on large projects. Disappointed, I'll stick to core 3 for now
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
That Open API is a standard that APIs even outside of .NET are using. It is the primary way to communicate your API's contract, so it is a big deal that it is already integrated. You can integrate it manually into a .NET Core 3 project (and you should). Also, don't forget that .NET 5 has massive speed improvements over .NET Core 3 and 3.1.
@hugogogo13
@hugogogo13 3 жыл бұрын
@@IAmTimCorey okay, will look into these speed improvements then, thank you
3 жыл бұрын
Thank you, Tim! I have a question to improve development experience; Yea, Swagger is great! As a mobile developer, I need that auto-generated doc badly and most backend developers just skip it. But, while I developing a backend with dotnet with watch option I have trouble; every time dotnet restarts itself because of a change of a file Swagger page also refreshes itself. That seems nice at the beginning but you lose all of the form data you have in Swagger. So, you must re-write every data every time. That is pretty frustrating. Does anybody have a solution for that? It should keep the form data after refreshing or auto-refresh can be disabled.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
The developers are working on a better version of watch that is built into Visual Studio. Right now, though, there is not a better solution.
@Ankhtepot
@Ankhtepot 3 жыл бұрын
Use Postman could maybe help you with this? At least to keep entered form data.
@davidmil15
@davidmil15 3 жыл бұрын
It’s funny how swagger/opeapi is catching up to the features we had in SOAP 10 years ago lol.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Yeah, it is bringing back some of the good parts.
@bobweiram6321
@bobweiram6321 2 жыл бұрын
Can the CORS policy be set in a config file instead of startup?
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You can put the settings in a config, but they still need to be set in the Startup.
@stewarthyde5111
@stewarthyde5111 3 жыл бұрын
One thing I am curious about is best practices when converting .Net Core 3.1 and even .Net Frameworks to .Net 5.0. I attempted to directly change .Net core 3.1 Blazor Webassembly project and it came up with errors with some of classed and also because .Net Standard
@stewarthyde5111
@stewarthyde5111 3 жыл бұрын
I believe part of issue was compile change - it thought one of classes was a name space
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I'll probably do a video on upgrading from .NET Core 3.1 to .NET 5.
@andywalter7426
@andywalter7426 3 жыл бұрын
I have a question. When showing the demo, why did you not choose the aspnet core hosted for web assembly. I see that most professional developers would choose that option for most of their projects. What happens then is you still have the web assembly. However, it seems to make it easier to communicate with the backend. Especially of the back end is the same url as the web assembly pages.
@pilotboba
@pilotboba 3 жыл бұрын
If you are talking about Server Side Blazor... there are con's against it.
@andywalter7426
@andywalter7426 3 жыл бұрын
@@pilotboba No, I was talking about still using web assembly but aspnet core hosted. If that option is chosen, there are 3 projects in the solution. One is the server. One is the client and the last one is the shared. For the sample, the client already talks to the server weather service.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
When checking that option, you are creating an API project with your Blazor WebAssembly. I didn't want that because I already had an API. No need to create a second API.
@cavinrauch
@cavinrauch 3 жыл бұрын
What extensions are you using in vs ? Specifically the extension that displays the parameter names
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
That's built into Visual Studio now. I try hard not to use extensions. I believe the only one I am using is one to change the font size. Here's how to get those inline parameter names: kzfaq.info/get/bejne/nJaJmLma17G0lqs.html
@cavinrauch
@cavinrauch 3 жыл бұрын
​@@IAmTimCorey Thank you so much! Super awesome little feature they added that I missed. While I was there I also found IntelliSense's "Show items from unimported namespaces" option, another thing I wish I found sooner. But thanks so much for the amazing videos! Wouldn't be where I am today without half of them
@michelchaghoury870
@michelchaghoury870 3 жыл бұрын
Hy, As Always I have A question here we have only to projects, not a big problem but if I have multiple projects that get data from the web API(OpenApi/Swagger), I need to add that JSON file in all the projects that will make HttpCalls if I have to change my swagger setting now I have to change them in all my other projects I there a way to solve that issue? and tnx a lot for your work
@pilotboba
@pilotboba 3 жыл бұрын
You can add after build events to your projects so when it builds, it does more stuff. This can generate your clients. Take a look at github.com/jasontaylordev/CleanArchitecture for some examples of a template that does some of this stuff.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Well, if you are changing your API then it would make sense that you are changing your clients that rely on your API. Now if you created a class library that talked to the API and your multiple projects used that same class library, it would be much easier to update everything. That's why we typically do not update an API once it is in production (except bug fixes). Instead, we create a new version so that new clients can get the new stuff and we don't break the old clients. Since the old clients use the v1 json file, nothing will change.
@michelchaghoury870
@michelchaghoury870 3 жыл бұрын
@@IAmTimCorey tnx alott
@pilotboba
@pilotboba 3 жыл бұрын
@@IAmTimCorey I see this is an issue more for two circumstances: 1. Your still in dev, and the API endpoints are very much in flux. 2. This is a private API that only your client side apps use, and not something you publish for public consumption. Some people say, never version your API, it's a new API. Some people say version one any change. Some say only version on a breaking change, etc. It's adult diapers all around. (depends)
@HugRunner
@HugRunner 3 жыл бұрын
If you were to connect the OpenAPI connected service using URL to the API URL where the swagger.json file is generated instead, would the generated client auto-update on build or is it a manual process to fetch from the URL each time you want to update? Also, I guess there are resources/documentation out there to configuring NSwag, but I think it would have been nice if you at least showed in this video how you would go about fixing the DateTimeOffset to DateTime, just to show that it's no big deal, instead of just skipping it and in a way implying that it would take a lot of time so not worth covering in this video.
@theobellash6440
@theobellash6440 3 жыл бұрын
I like your videos MOSH but one suggestion, please make short videos because we always don't have enough time to play your videos. Please make 10 minutes videos or less than 20
@hashimkz
@hashimkz 3 жыл бұрын
Just watch half of it at a time? Or at 2x speed?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I work hard to provide real-world context so that you can take what you learn and apply it to the real world right away. That takes time.
@mcorplab2719
@mcorplab2719 3 жыл бұрын
Just watch it in 10 minutes chunks buddy. :)
@devcisse9425
@devcisse9425 3 жыл бұрын
whats that cheat called in 40:13 and is it free for VS community 2019 ?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
The cheat isn't a feature, it is a shortcut. When I did "new HttpClient()", I really should have pulled that from a HttpClientFactory that I had set up. Otherwise, the app could clog up my connections to the Internet. You can find out more about how to do it right here: kzfaq.info/get/bejne/md2Xls5i0Ja9e4k.html
@devcisse9425
@devcisse9425 3 жыл бұрын
@@IAmTimCorey Oh. I thought it was something that can be enabled from VS. I love the hint
@fidel_soto
@fidel_soto 3 жыл бұрын
So they added swagger to WebAPI? Got it.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Yep.
@user-fp6cr1wi2q
@user-fp6cr1wi2q 3 жыл бұрын
It's like good old wsdl :D In 2020 history kinda make a loop :D
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Pretty much.
@scott98390
@scott98390 3 жыл бұрын
I don't understand why you say that the *HttpClient* is managed by *HttpClientFactory* - it looks to me like when you call *builder.services.AddScoped()* you're just newing up a new client for each request, and the factory is not involved. I'd love to see a tutorial on the right way to use *HttpClient* and *HttpClientFactory.*
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
The factory operates behind the scenes for that scoped call, but yes, it is a bit of a black box. I'm adding it to my suggestion list for a future video.
@jimlynch8313
@jimlynch8313 3 жыл бұрын
For anyone trying this and getting an error on Building BlazorWasmDemo you may need to update your NuGet packages (NSwag.ApiDescription.Client 13.0.5 > 13.9.4 as of this comment; Microsoft.Extensions.ApiDescription.Client 3.0.0 > 5.0.0 as of this comment)
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Interesting. Did you make sure your Blazor WASM project was .NET 5 and not .NET Core 3.1?
@jimlynch8313
@jimlynch8313 3 жыл бұрын
@@IAmTimCorey I did. I even tested against your source code to verify I didn't miss anything. Although, I seem to remember someone once said it's not a bad idea to update NuGet packages if it's a new project. By chance, could you have been running VS 16.8.1? I used 16.8.2 (released on Nov. 19) and this could have been something that was affected in the update, though I don't see anything about this specifically on the patch notes page.
@luisc1794
@luisc1794 3 жыл бұрын
I couldn't see the file swaggerClient.cs in obj folder, this helps me
@anatoliytkachenko1498
@anatoliytkachenko1498 3 жыл бұрын
like
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thanks!
@damianrecinski7329
@damianrecinski7329 3 жыл бұрын
Blazor default layout is terrible.. Gradients were popular in 2010..
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
It is meant to show you what could be done. It will always be on you to develop what you really want, so who cares what the starting point is?
@carlosjosejimenezbermudez9255
@carlosjosejimenezbermudez9255 3 жыл бұрын
They are getting popular again in case you haven't noticed. Maybe not the way they implemented it though.
@sglasgowaz
@sglasgowaz 3 жыл бұрын
Create your own default template instead of using the default? I mean, seriously, are you upset Tim just ran with the default or that the base template for Blazor isn't what you like? Tim's demos are meant to be exactly what the default is for anyone wanting to code along. You may as well say apples are terrible.
@damianrecinski7329
@damianrecinski7329 3 жыл бұрын
@@sglasgowaz I dont get your point. I wasn't referring to Tim's video, but to Blazor directly. I just think, that showing default template with such a poor appearance isn't the best way to convince ppl to use it. If you start new asp.net mvc5 app, default template is acceptable, even so it was created many years ago.
@LuigiZambetti
@LuigiZambetti 3 жыл бұрын
Sad case that Microsoft doesn’t want to pursue WCF technology.
@kblyr
@kblyr 3 жыл бұрын
In my experience, It's hard to make a working WCF service
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I know there are a lot of people who want WCF. Fortunately, Microsoft gave away their source code and an independent team is working on a .NET Core implementation of WCF.
@pilotboba
@pilotboba 3 жыл бұрын
Yes, the are moving forward with gRPC like most other platforms.
@user-fu6mp6et8p
@user-fu6mp6et8p 3 жыл бұрын
Вот блин, самый популярный влоггер со специализацией по туториалам в интернете, но качество каждый раз ниже ожиданий. Постоянно ухожу с его видео разочарованным по нескольким причинам: - нет краткого описания содержания видео в начале - видео каждый раз затянуты - мусолятся несущественные для темы видео аспекты - нет глубокого погружения в технологию, описания каких-либо подводных камней В итоге каждый раз одно расстройство зря потраченным временем.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Sorry Tim's videos don't meet your expectations, but thanks for repeatedly watching.
@Esico6
@Esico6 3 жыл бұрын
Every year its different. You have to use this or that. Not liking that anymore.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I'm not sure what you see as a change. There are upgrades, but nothing that requires you to even do anything. If you totally ignored Swagger, it would not be in your production app and you would not need to do anything to test out your app on F5. Nothing was taken away. You also have the checkbox when creating the app to not include OpenAPI (Swagger).
@flogginga_dead_horse4022
@flogginga_dead_horse4022 3 жыл бұрын
yep 20 years, every year or two change everything lol
@SayWhaaaaaaaaaaaaaaaaaaaaaaat
@SayWhaaaaaaaaaaaaaaaaaaaaaaat 3 жыл бұрын
Nonsense... why da hell they include all that crap like TRY IT OUT..and so on?? install Postman and try it..why api have so much junk in it? Yes it's nice to have documentation, but ability to do request and so on-dumb.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You aren't fighting Microsoft here, you are fighting the industry. This is an industry standard way of presenting an API "which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic." ( spec.openapis.org/oas/v3.0.3 ). This allows for simple understanding of the API, including seeing how it works, without the need for third-party systems. This is not a Microsoft thing. It is how the industry decided to document APIs in a uniform manner.
Big Changes in .NET 5, C# 9, and Visual Studio 2019 (v16.8)
21:51
IAmTimCorey
Рет қаралды 115 М.
Fix Your Controllers By Refactoring To Minimal APIs
14:56
Milan Jovanović
Рет қаралды 37 М.
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 41 МЛН
No empty
00:35
Mamasoboliha
Рет қаралды 10 МЛН
OpenAPI & .NET: You're Doing It Wrong - Mark Rendle - NDC London 2023
1:01:08
Stop, Intel’s Already Dead!
13:47
Linus Tech Tips
Рет қаралды 706 М.
Forget Controllers and Minimal APIs in .NET!
14:07
Nick Chapsas
Рет қаралды 63 М.
Intro to Redis in C# - Caching Made Easy
1:27:29
IAmTimCorey
Рет қаралды 175 М.
I've been using Redis wrong this whole time...
20:53
Dreams of Code
Рет қаралды 348 М.
ASP.NET Core Full Course For Beginners
3:43:18
Julio Casal
Рет қаралды 165 М.
REST API and OpenAPI: It’s Not an Either/Or Question
9:17
IBM Technology
Рет қаралды 206 М.
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 41 МЛН