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 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.
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
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?
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.
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
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.
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?
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.
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?
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.
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.
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?
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!
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 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.
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.
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: th-cam.com/video/cwgck1k0YKU/w-d-xo.html
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.
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.
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!
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: th-cam.com/video/f0YeVirKPfw/w-d-xo.html
@@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
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
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?
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
@@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.
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) ?
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.
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
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.
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
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.
4 ปีที่แล้ว
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.
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
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
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.
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.
@@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)
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 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.
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.*
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.
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.
@@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.
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.
Вот блин, самый популярный влоггер со специализацией по туториалам в интернете, но качество каждый раз ниже ожиданий. Постоянно ухожу с его видео разочарованным по нескольким причинам: - нет краткого описания содержания видео в начале - видео каждый раз затянуты - мусолятся несущественные для темы видео аспекты - нет глубокого погружения в технологию, описания каких-либо подводных камней В итоге каждый раз одно расстройство зря потраченным временем.
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).
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.
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.
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
I am glad it was helpful.
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
Thank you! Posted.
Last example where you use a console application is great for understanding. Thanks Tim!
Glad it was helpful!
@IAmTimCorey I loved the way to explain things. I am waiting for your tutorial on microservices with docker.
Thanks!
Thanks Tim, great stuff. And awesome explanation.
Awaiting for the authentication/authorization video.
You are welcome.
@@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.
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
Glad it was helpful.
I can see there are improvements in .net core. More and more features added. I hope I can catch up one day 😊
Yes, definitely
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?
I would also like to see in depth tutorial for NSwagger
I will add it to the list. Thanks for the suggestion.
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.
Thanks for sharing
As always, awesome content Tim!!!
Thanks!
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
I will add it to the list. Thanks for the suggestion.
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
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?
That would be fine.
Great stuff! Do you think you could create a course with WebAPI and React?
Not sure about React. I've got a ways to go before I get into JavaScript frameworks.
Maybe blazer?
@@JohnPeter-yf5jf Tim has a lot of Blazor videos for you to check out
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.
Good Tip!
Thank you Tim Corey for this video, and we need video for Xamarin android. Thanks and best Regards.
You are welcome.
Wow Tim, this was great!!! Exactly, what I was looking for!
Glad to hear it
p.s. I second Troy Mitchel's request for a course with WebAPI and React?
Thanks for the vote.
@@IAmTimCorey I would rather see Angular than React :-)
Blazor Wasm, it's new, that's my opinion.
Hey Tim
Thanks for uploading this video. Have you found a way to read the response headers?
Very useful. Thanks a lot
You are welcome.
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?
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.
Please share what you find
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?
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.
We appreciate the suggestion and I have added it to Tim's list.
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.
Interesting! Thanks for the tips.
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.
You can open up your firewall and publish your IISExpress URL locally so that people can access it and test against it.
Thank you, sir.
Thanks for trusting Tim with your trsaining.
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?
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.
It is a similar concept, yes.
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?
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!
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.
If you are talking about Server Side Blazor... there are con's against it.
@@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.
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.
whats that cheat called in 40:13 and is it free for VS community 2019 ?
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: th-cam.com/video/cwgck1k0YKU/w-d-xo.html
@@IAmTimCorey Oh. I thought it was something that can be enabled from VS. I love the hint
Can the CORS policy be set in a config file instead of startup?
You can put the settings in a config, but they still need to be set in the Startup.
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.
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.
Wew! This is great tutorial!
so easily to catch up
even for beginners for me
Glad it was helpful!
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!
I haven’t covered it yet but it is a priority to cover.
What extensions are you using in vs ?
Specifically the extension that displays the parameter names
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: th-cam.com/video/f0YeVirKPfw/w-d-xo.html
@@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
Excellent
Thanks!
this tutorial is really helpful can you please make a video on Azure pipelines
Check out these videos - th-cam.com/users/IAmTimCoreysearch?query=devops
It’s funny how swagger/opeapi is catching up to the features we had in SOAP 10 years ago lol.
Yeah, it is bringing back some of the good parts.
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
You can tell it to generate an interface as well.
Great stuff! this is really wonderful and highly appreciated.
Glad it was helpful!
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?
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
I believe part of issue was compile change - it thought one of classes was a name space
I'll probably do a video on upgrading from .NET Core 3.1 to .NET 5.
I didn't understand it.. but I enjoyed it. !
Practice what you see. It will help you grasp the concepts. That's what I do.
@@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.
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) ?
I'm not sure about that.
So they added swagger to WebAPI? Got it.
Yep.
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.
Excellent Tip! Thanks for sharing.
Awesome! Thank you!!
You're welcome!
greetings. thank you. very informative and useful
Glad it was helpful!
Thank you
Thank you for being part of the community!
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
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.
@@IAmTimCorey okay, will look into these speed improvements then, thank you
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
I noted your recommendation and have added to my list, thanks.
Great tutorial. Thank you !
You are welcome!
Will you go over (1) how to generate openapi client without Visual Studio (for Mac users) and (2) NSwag.MSBuild on auto generating clients?
Nope, I'm not going that deep. I'm just introducing the topic. I may go deeper in another video.
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.
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.
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.
Use Postman could maybe help you with this? At least to keep entered form data.
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
Just watch half of it at a time? Or at 2x speed?
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.
Just watch it in 10 minutes chunks buddy. :)
It's like good old wsdl :D In 2020 history kinda make a loop :D
Pretty much.
Greate tutorial, thank you so much
You're very welcome!
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
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.
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.
@@IAmTimCorey tnx alott
@@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)
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)
Interesting. Did you make sure your Blazor WASM project was .NET 5 and not .NET Core 3.1?
@@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.
I couldn't see the file swaggerClient.cs in obj folder, this helps me
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.*
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.
nice
Blazor default layout is terrible.. Gradients were popular in 2010..
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?
They are getting popular again in case you haven't noticed. Maybe not the way they implemented it though.
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.
@@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.
Sad case that Microsoft doesn’t want to pursue WCF technology.
In my experience, It's hard to make a working WCF service
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.
Yes, the are moving forward with gRPC like most other platforms.
like
Thanks!
Вот блин, самый популярный влоггер со специализацией по туториалам в интернете, но качество каждый раз ниже ожиданий. Постоянно ухожу с его видео разочарованным по нескольким причинам:
- нет краткого описания содержания видео в начале
- видео каждый раз затянуты
- мусолятся несущественные для темы видео аспекты
- нет глубокого погружения в технологию, описания каких-либо подводных камней
В итоге каждый раз одно расстройство зря потраченным временем.
Sorry Tim's videos don't meet your expectations, but thanks for repeatedly watching.
Every year its different. You have to use this or that. Not liking that anymore.
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).
yep 20 years, every year or two change everything lol
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.
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.