3 (and more) ways to set configuration values in .NET
Every application relies on some configurations. Many devs set them up using only the appsettings file. But there's more!
Every application relies on some configurations. Many devs set them up using only the appsettings file. But there's more!
In this article, I will show you two simple tricks that help me understand the deployment status of my .NET APIs
APIs often call other APIs to perform operations. If an error occurs in one of them, how can you understand the context that caused that error? You can use Correlation IDs in your logs!
Propagating HTTP Headers can be useful, especially when dealing with Correlation IDs. It's time to customize our HttpClients!
LINQPad is one of the tools I use daily. But still, I haven't used it at its full power. And you?
A suitable constructor for type 'X' could not be located. What a strange error message! Luckily it's easy to solve.
Logs are important. Properly structured logs can be the key to resolving some critical issues. With Serilog's Scopes, you can enrich your logs with info about the context where they happened.
If your application is exposed on the Web, I guess that you get some values from the HTTP Requests, don't you?
Keeping an eye on maintainability is mandatory for every project which should live long. With NDepend, you can measure maintainability for .NET projects.
Is your application slow? How to find bottlenecks? If so, you can use MiniProfiler to profile a .NET API application and analyze the timings of the different operations.
Did you know that in .NET you can resolve specific dependencies using Factories? We'll use them to switch between concrete classes based on the current HTTP Request
Moq and NSubstitute are two of the most used library to mock dependencies on your Unit Tests. How do they differ? How can we move from one library to the other?
Serilog is a famous logger for .NET projects. In this article, we will learn how to integrate it in a .NET API project and output the logs on a Console.
Every time you ask Visual Studio to generate properties for you, it creates them with a simple,default format. But we can customize them by updating some options on our IDE. Let's learn how!
You should not add the caching logic in the same component used for retrieving data from external sources: you'd better use the Decorator Pattern. We'll see how to use it, what benefits it brings to your application, and how to use Scrutor to add it to your .NET projects.
Debugging our .NET applications can be cumbersome. With the DebuggerDisplay attribute we can simplify it by displaying custom messages.
Senders and Receivers handle errors on Azure Service Bus differently. We'll see how to catch them, what they mean and how to fix them. We'll also introduce Dead Letters.
Queues or Topics? How are they similar and how they are different? We'll see how to use those capabilities in Azure Service Bus with .NET and C#
Azure Service bus is a message broker generally used for sharing messages between applications. In this article, we're gonna see an introduction to Azure Service Bus, and how to work with it with .NET and C#
Knowing the Assembly Version of the API you've deployed on an environment may be helpful for many reasons. We're gonna see why, how to retrieve it, and how to expose it with Endpoint Routing (bye-bye Controllers and Actions!)
It's not a good practice to return the ID of a newly created item in the HTTP Response Body. What to do? You can return it in the HTTP Response Headers, with CreatedAtAction and CreatedAtRoute.
Language details may impact application performance. In this article we'll see some of the C# tips that brought me to improve my application. Singleton creation, StringBuilder and more!
Having fast API response is crucial for your applications. In this article you'll see how I managed to improve an API application that took 14 secs each call.
With HttpRepl you can perform HTTP operations as they were local folders, using the CLI. Let's see how to configure it and run GET and POST operations.
Swagger is a tool that exposes the documentation of your APIs and helps collaborating with other teams. We'll see how to integrate it with .NET Core 3, how to add XML comments and status codes.
Integration tests are useful to check if multiple components fit together well. How can you test your APIs? And how can you mock dependencies?
Sometimes on your tests you need to access test files, for example for mocking external data. With manifest resources you can easily reference files for your tests.
BenchmarkDotNet allows you to test the performance on .NET methods. So let's answer a question: is the Enum.HasFlag method really that slow?
Validating inputs is crucial for every application. If you want an easy and versatile way, you can try FluentValidation.
Internal members can be accessed only within the same assembly. And for different assemblies? Here's for you the InternalsVisibleTo attribute!
Singleton, Scoped and Transient: these are the possible lifetimes for DI with .NET Core. How do they change the way objects are constructed?
Having a robust logging system is crucial for any application. There are many tools, and one of these is Serilog. Here you'll learn how to use it in a .NET application and how to integrate it with Seq.
Do you have an Azure Function that you want to upgrade from v2 to v3? Don't panic, it's just a matter of few steps!
Azure Functions are one of the best examples of serverless applications. By default you can't use Dependency injection: here's how you can configure it by adding the Startup class.
Asynchronous programming is often seen as something cumbersome, so many developers avoid it. What, why and how to use it? Here are the first steps you can take to approach async programming.
We have already seen how to search for videos in a YouTube channel. Now it's time to get details for a single video.
YouTube provides some APIs for getting info about a channel videos. But they also provide .NET libraries to achieve the same result with C#. Let's have a try!
Extension methods in C# are really useful, but there are few rules to follow...
More than 50% of mobile users abandon a website if it takes more than 3 seconds to load. Here you'll learn few trick to improve your site performance.
On November I shared on Twitter an article each day. They were about C#, general programming and advanced topics. For celebrating the conclusion of this challenge, I wrote a poem about that.
Is it true that the inverse of a negative number is always a positive number? If you think it's true, you might get a subtle error while implementing comparison.
Error CS0246 - Type or namespace could not be found. What does it mean? Why does it happen? How can you solve it?
Some of the things I learned at .NET Conf Italia: interfaces and abstract classes, Blazor, C# default interfaces and .NET Core on Samsung TV