- Видео 131
- Просмотров 856 313
Round The Code
Великобритания
Добавлен 29 сен 2019
.NET, C# and ASP.NET Core tutorials, code examples, courses, videos and coding challenges for software developers to learn.
Focusing on tutorials from frameworks such as Web API, MVC and Blazor, as well as topics ranging from authorisation, dependency injection and configuration to name a few.
We'll also demonstrate some of the new features that are available when a new version of .NET and C# is released.
As a bonus, a number of our tutorials will have code examples so you can download the code from the tutorial and try it out for yourself.
Focusing on tutorials from frameworks such as Web API, MVC and Blazor, as well as topics ranging from authorisation, dependency injection and configuration to name a few.
We'll also demonstrate some of the new features that are available when a new version of .NET and C# is released.
As a bonus, a number of our tutorials will have code examples so you can download the code from the tutorial and try it out for yourself.
How do you write a Dockerfile for an ASP.NET Core app?
Learn how to Dockerize your ASP.NET Core application by writing a Dockerfile.
We'll show you how to restore, build and publish an ASP.NET Core Web API into Docker.
After that, we'll show you how to use the Docker CLI to build and run your application in a Dockerized container.
💻 Download the code example💻
www.roundthecode.com/dotnet-code-examples/run-asp-net-core-application-docker-container?GAnT23KBSEI+-+video+content+%28code+example%29
► Read the tutorial:
www.roundthecode.com/dotnet-tutorials/how-do-you-write-dockerfile-asp-net-core-app?GAnT23KBSEI+-+video+content+%28tutorial%29
🎓 .NET tutorials, code examples and coding challenges 🎓
www.roundthecode.com/?GAnT23KBSEI+-+video+content+%28roundt...
We'll show you how to restore, build and publish an ASP.NET Core Web API into Docker.
After that, we'll show you how to use the Docker CLI to build and run your application in a Dockerized container.
💻 Download the code example💻
www.roundthecode.com/dotnet-code-examples/run-asp-net-core-application-docker-container?GAnT23KBSEI+-+video+content+%28code+example%29
► Read the tutorial:
www.roundthecode.com/dotnet-tutorials/how-do-you-write-dockerfile-asp-net-core-app?GAnT23KBSEI+-+video+content+%28tutorial%29
🎓 .NET tutorials, code examples and coding challenges 🎓
www.roundthecode.com/?GAnT23KBSEI+-+video+content+%28roundt...
Просмотров: 586
Видео
Static asset file sizes can be reduced by over 80% in .NET 9
Просмотров 75921 день назад
A new .NET 9 feature can reduce the file size to your static assets by over 80%! The static asset delivery optimisation feature compresses static files using the Brotli and GZip compression types. Find out how you can enable it in your ASP.NET Core project and how it works. We'll also look at some of the drawbacks and how you can get around them. ► Read the tutorial: www.roundthecode.com/dotnet...
Swagger dropped in .NET 9: What are the alternatives?
Просмотров 2,6 тыс.Месяц назад
Swashbuckle which uses the Swagger UI has been dropped from the ASP.NET Core Web API template in .NET 9. That means there is no UI to test your Web API endpoints when creating a new project. Instead, it's been replaced with OpenAPI documentation with no testing functionality. We'll have a look at the alternatives to Swashbuckle such as NSwag, Scalar and Postman to see if there is a better one. ...
What's new in .NET 9? Key features you need to know!
Просмотров 1,4 тыс.Месяц назад
Learn about the key features that are new in .NET 9. We'll cover new LINQ methods, Minimal API improvements, a keyed services update, OpenAPI document generation support and the new HybridCache library. You can use all of these features in your ASP.NET Core application. 💻 Download the code example💻 www.roundthecode.com/dotnet-code-examples/dotnet-9-code-example-download-new-key-features?HNbLXhq...
C# 13 released with new features that you can use now
Просмотров 1,4 тыс.Месяц назад
C# 13 has been launched as part of the .NET 9 release and we'll have a look at the new exciting features that you can use today. As well as that, we'll show you what you need to download and install to start using C# 13. It's also possible to use C# 13 without updating your project to .NET 9. Let us show you the steps in order to do this. ► ruclips.net/video/nk_aYYxFyig/видео.html 💻 Download th...
.NET 9 has been released: How do you update?
Просмотров 3,6 тыс.2 месяца назад
.NET 9 has been released and we'll show you how you can update Visual Studio, download the SDK and upgrade your project. We'll also show you what you need to do if you're using Docker and how you install the ASP.NET Core Runtime on your Windows Server to support IIS. As well as that, we'll also ask the question whether you should update and looking at breaking changes, what new features you mig...
Data Annotations or FluentValidation for .NET validation?
Просмотров 9313 месяца назад
Data Annotations and FluentValidation are useful validation tools for your .NET project. But which one should you use? We'll start off by reviewing Data Annotations. We'll show you how to add a validation attribute to a C# class property, such as the Required attribute. As well as that, we'll show you how it works in an ASP.NET Core Web API controller by creating and testing an endpoint. Afterw...
What is a partial class in C# and why should you use them?
Просмотров 4384 месяца назад
We have a look at how to use a partial class in C# and what rules we need to follow so our .NET project will compile. As well as that, we'll have a look at how to use partial methods in a partial class and how they can be helpful with source generated files. Finally, we'll understand the reasons as to why we would use partial classes in the first place. ► Read the tutorial: www.roundthecode.com...
Entity Framework Core features to help you migrate data
Просмотров 6084 месяца назад
Looking at some Entity Framework Core migration features that you might not know about. These changes will make it easier to configure your entities, add an initial set of data, run a SQL script and converting to a particular type when saving a record in the database when applying an EF Core migration. ► Read the article: www.roundthecode.com/dotnet-blog/ef-core-migration-features-you-might-not...
How to use feature flags in .NET to toggle features on & off
Просмотров 9395 месяцев назад
Learn how to add ASP.NET Core's feature management package by adding feature flags that can be enabled and disabled. As well as that, you'll learn some of the filters that are included and how you can write your own custom one. And if you use MVC, you'll learn how to use the feature tag helper so you can display content depending on whether a feature flag is enabled or not. ► Read the tutorial:...
Use SignalR to send and receive a message in real-time
Просмотров 1,2 тыс.5 месяцев назад
Learn how to add SignalR hub to an ASP.NET Core application and add real-time messaging between the client and the server. We'll set up the hub and add it to the ASP.NET Core application. Afterwards, we'll add the connection to the front-end using JavaScript and show you how to send a message to SignalR, receive a message back and output it to the client. 💻 Download the code example💻 www.roundt...
How should you get config values from appsettings.json?
Просмотров 8355 месяцев назад
When using configuration values in an ASP.NET Core Web API, you can either inject IConfiguration, IOptions, or IOptionsSnapshot into your API controller. We'll inject each one into a controller, test them using an API endpoint to see what they return, and change the configuration values in appsettings.json to see if the change is updated whilst the application is still running. ► Read the tutor...
What's it like using VS Code to build a .NET project?
Просмотров 1,7 тыс.6 месяцев назад
We've dropped Visual Studio and developed a .NET project using Visual Studio Code. How easy it is to use? After downloading VS Code and the .NET SDK, we'll add the extensions that will help you to develop a .NET application. We'll create an ASP.NET Core Web API, develop some services and some controllers. Afterwards we'll build and run the application. As well as that, we'll look at how we can ...
Add geolocation to .NET & find the location of an IP address
Просмотров 8206 месяцев назад
Learn how to add geolocation for free to your .NET project by doing an IPv4 address lookup so you know the country as to where each of your clients are located. We'll show you how to add it for each of your client's IP address and how you can get the IP address if you are using a reverse proxy like Cloudflare. As well as that, we'll also show you how you can get city information from your clien...
Add Stripe to .NET and start taking online payments
Просмотров 9716 месяцев назад
Learn how to add Stripe to your ASP.NET Core project to take online payments. This checkout example will use the Stripe.net NuGet package so you can easily integrate it into your .NET project. We'll code the Stripe solution in an ASP.NET Core Web API endpoint and show how you how to redirect a user to Stripe. We'll also look at how to set up a Stripe account and get an API key. 💻 Download the c...
Do try, catch and finally code blocks always run in C#?
Просмотров 2856 месяцев назад
Do try, catch and finally code blocks always run in C#?
C# changes you may not know about to help write cleaner code
Просмотров 7257 месяцев назад
C# changes you may not know about to help write cleaner code
Why you must use async/await in C# to make API calls
Просмотров 3,2 тыс.7 месяцев назад
Why you must use async/await in C# to make API calls
.NET 7 apps must be updated now to stop vulnerabilities
Просмотров 1,3 тыс.7 месяцев назад
.NET 7 apps must be updated now to stop vulnerabilities
Use HttpClient the correct way to avoid socket exceptions
Просмотров 1,3 тыс.7 месяцев назад
Use HttpClient the correct way to avoid socket exceptions
8 C# technical questions you need to know for an interview
Просмотров 1,6 тыс.8 месяцев назад
8 C# technical questions you need to know for an interview
Are you prepared for your next .NET interview?
Просмотров 6608 месяцев назад
Are you prepared for your next .NET interview?
Your .NET resume needs to stand out to land your next job!
Просмотров 2,9 тыс.8 месяцев назад
Your .NET resume needs to stand out to land your next job!
How to use Moq to mock xUnit tests for a .NET project
Просмотров 1,8 тыс.9 месяцев назад
How to use Moq to mock xUnit tests for a .NET project
xUnit tutorial: How to run unit testing in C#
Просмотров 1,7 тыс.9 месяцев назад
xUnit tutorial: How to run unit testing in C#
Create ASP.NET Core Web API CRUD methods (& test in Postman)
Просмотров 2,1 тыс.9 месяцев назад
Create ASP.NET Core Web API CRUD methods (& test in Postman)
How to create an ASP.NET Core Web API project in .NET 8
Просмотров 2,3 тыс.10 месяцев назад
How to create an ASP.NET Core Web API project in .NET 8
How to write custom middleware in ASP.NET Core
Просмотров 61610 месяцев назад
How to write custom middleware in ASP.NET Core
Raw SQL queries & stored procedures in Entity Framework Core
Просмотров 4,8 тыс.10 месяцев назад
Raw SQL queries & stored procedures in Entity Framework Core
Include method for one to many relationships in EF Core
Просмотров 1,8 тыс.10 месяцев назад
Include method for one to many relationships in EF Core
I don't know, I could just install the Swashbuckle package and then point it to the new openapi json in the config, works as before. The real new thing are the openapi extensions and annotations that generate it.
This tutorial helped me a lot! I had an error 1053 until i installed the package you pointed out, and added .UseWindowsService() .
Great ! Do you have a tutorial Stripe with Asp Net Core MVC?
Can you explain how to create a installer for a .NET Worker Service by using Microsoft Installer Project extension in Visual Studio 2022?
nice save to database tutorial
Thanks. Glad you found it useful.
If you have your DbContext set up skip to 4:46
// Original dictionary var originalDict = new Dictionary<string, string> { { "Key1", "Value1" }, { "Key2", "Value2" }, { "Key3", "Value1" }, { "Key4", "Value3" }, { "Key5", "Value2" }, { "Key6", "Value1" } }; // Using LINQ to count the occurrences of values var valueCounts = originalDict .GroupBy(pair => pair.Value) // Group by values .ToDictionary(group => group.Key, group => group.Count()); // Convert to dictionary // Output the result foreach (var kvp in valueCounts) { Console.WriteLine($"Value: {kvp.Key}, Count: {kvp.Value}"); }
Don t use (using) httpclien if you are creating it with factory because you are destroying all the smart work of this factory
I subscribed 🚀
Thanks Justin.
The title is pretty misleading. It reads like the whole support for swagger is removed. Not only the swagger-ui. It made me panic a bit internally. It sure did bait me to click 😋
That's how you choose to read it 😆. I personally think Scalar is a much better alternative to Swagger anyways from what I've seen so far.
Need sourcegenerator. İsourcegenerator approch is futture
Great video! Came to know about Scalar & Kiota due to this video. Keep up the good work.
Thanks, will do!
You can also use swagger with the new openapi without installing any other packages.
How do you do that?
@@RoundTheCode Use only app.UseSwaggerUI ({app.UseSwaggerUI(options => {options.SwaggerEndpoint("/openapi/v1.json","Name API")})}) Sorry for format code.
cool video! thanks for sharing. so you just don’t get the swagger-ui but get the api docs?
By default, yes.
Thanks
You're welcome.
To generate api client, have you checked Kiota by Microsoft?
I haven't. What does it do?
@ generate api client for your API in most common languages.
I like Scalar as alternative, but options doesn't work in my projects (title, theme etc.) as well as versioning :(
It's not for every one but it does have some significant improvements to Swagger.
Swashbuckle is maintained again and supports .NET9 😊
Nice
Thanks for the comment.
Thank you for this! Studying for an interview, it's just what I've been looking for. Subscribed!
Good to hear. All the best in your interview
why white theme in 2024 ...
Why not?
@@RoundTheCode that blind you ..
😆
cool,
Certainly is!
Lmfao. 0:17
😆
I didnt understand for the middleware why the constructor supports singleton, transient lifetimes whereas invoke method supports singleton, transient and scoped . ..
The middleware is constructed when the app starts up and therefore has app lifetime (singleton). Scoped services can't be injected into singleton instances. Invoke or InvokeAsync is called on every HTTP request which is part of a scope. More information about it here. learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/write?view=aspnetcore-9.0&viewFallbackFrom=aspnetcore-2.2#per-request-middleware-dependencies You can go down the factory middleware if you want more control over the lifetime. learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/extensibility?view=aspnetcore-9.0
Great video. How about making a follow up on how to add another stage/environment?
How to use MapStaticAssets in razor pages? cause for blazor it needs to reference the assets using "@Assets" also using <ImportTag />, but none of these available in razor pages? any ideas?
I would suggest creating a new Blazor Web App in .NET 9 and looking at the code. The template sets MapStaticAssets by default in Program.cs and App.razor shows how it references the app.css file which is in the wwwroot folder. This happens when creating a Blazor Server project.
@ For blazor it's clear, but for razor pages or mvc (.cshtml in general) is not clear.
You just reference it as normal. E.g. <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /> What I believe happens is that the app will look at the Accept-Encoding header in the request. If either gzip or br are contained in there, the app will render one of the compressed files rather than the main file. Looks like the StaticAssetDevelopmentRuntimeHandler class does the work in development for rendering Gzip files. github.com/dotnet/aspnetcore/blob/eafaa76a7884cb580170fd0e5e68c0a253f84a1b/src/StaticAssets/src/Development/StaticAssetDevelopmentRuntimeHandler.cs#L25
Thanks :)
No problem!
Thank you
You're welcome. Glad you enjoyed the content.
Cool, that works! Thanks a lot!
Glad you got it working.
I really don't get why new lock tight with .NET 9 and C# 13 - even if we set the SDK to .NET 9 (AFAIK the compiler is what uses the C# versions). It's a bit confusing
Surprised me. I thought you would be able to use all the features in C# 13, even if you don't update to .NET 9.
Thanks
You're welcome.
I don't get it. Why don't you use the pipelines from the 'releases' menu?
That's the "old" way of doing it.
@@RoundTheCode Then it's a weird naming convention chosen by M$ :D
Sent you a couple bucks. Copilot couldn't tell me this....Appreciate the video!
Thanks for the donation.
Thanks!😁
Thanks very much for the donation. That's generous of you.
lmfao. Couldn't have picked more controversial names so casually and I love it.
What controversial names are they?
@RoundTheCode that's a trap 😂
Thank you
You're welcome
This is a great channel. Instantly subbed after Azure DevOps tutorial! If you could make videos on C# multi threading, parallel processing, concurrency, distributed concurrency etc. with diagrams and illustrations, that'd be great! Thank you!
Thanks. I'll consider them in the future.
Trick question. You don't
Would consider it for smaller projects, but will stick with .NET 8 for larger projects.
Great video, subbed
Thanks.
This is great. Thank you!
You're very welcome!
where i can find the code of the yml file in the video.in the download sending by mail i cant find it.thanks in adavnce.
They are in the root of the repo. The build pipeline is azure-pipelines.yml and the release pipeline is azure-pipelines-1.yml github.com/RoundTheCode/AzureTestProject/tree/main
Thank you very much for your videos. All of them are very useful. I'd like to confirm if my understanding is correct as I'm very new to this if you don't mind. Most of the time, if we don't need complicated access during the build, we can use Azure Managed agent to build our app. In this case, we only need 1 self-hosted agent here which is for deployment in the app server. Is this correct?
Yes if you can use an Azure managed agent I would use always use that. You can easily install supported .NET SDK's onto them through pipeline tasks. If you are deploying to IIS then you'll need a way of deploying your code and the best way is to use it as the agent.
Also I have not seen any custom logger implementation successfully using BeginScope method which is very crucial for setting traceability when logging multiple systems. Have you experimented with implementing BeginScope in any of the custom Iloggers ?
Great video, how do we get the original message template, transformed log and the arguments that were used to transform the log message template. public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter) Here the TState is being populated with an internal class and I don't see any other option other than using dirty reflections. Am I missing something ?
Hi! Can you please show me definition of GetProduct() method when you call it from GetProducts() in ApiController? GetProduct() has to be async method also?
Do you do project consulting
Yes I do. What project are you looking consultancy in?
@RoundTheCode can I have your emailid
This is fantastic. Would be great to see a whole series on Azure DevOps as there's not a lot of it on your channel so far, plus some of it is slightly out of date (but still very useful!)
Thanks for the idea. I will consider it.
Nice video series, could you please provide the source code ?
Awesome video, really clear. Worked first time for me. Thank you.
Great to hear!
Thank you so much this was incredibly helpful in replacing an old TraceListener ❤
You're very welcome!
Should a request dto make a Db call to see if User exists? I think request dtos should do more basic validation and then User exists is handled by the domain service, of course it works either way, but I think request dtos and domain logic easily gets tangled