Best of .NETJanuary 2025

  1. 1
    Article
    Avatar of medium_jsMedium·1y

    HTTP Client in C#: Best Practices for Experts

    This guide explores advanced best practices for using `HttpClient` in C#. It covers the creation of `HttpClient` instances using various methods like constructors, static instances, `IHttpClientFactory`, named, typed, and generated clients. The article also discusses middleware techniques, resilient handling of HTTP requests using timeout, retries, and circuit-breakers, and efficient ways to issue requests and handle responses while optimizing performance to avoid common pitfalls like port exhaustion and DNS changes.

  2. 2
    Article
    Avatar of milanjovanovicMilan Jovanović·1y

    Scaling Monoliths: A Practical Guide for Growing Systems

    Scaling monoliths can be achieved through various strategies such as vertical scaling, horizontal scaling, database scaling, caching, and using message queues. Vertical scaling involves adding more resources to a single machine, while horizontal scaling involves running multiple instances behind a load balancer. Database scaling can be done using read replicas, materialized views, and database sharding. Effective caching can reduce database load, and message queues can help manage traffic spikes by deferring heavy tasks. The key is to implement the right solution based on specific bottlenecks and system requirements.

  3. 3
    Video
    Avatar of communityCommunity Picks·1y

    .NET Project Setup From Scratch Using These 6 Best Practices

    Learn six essential best practices for setting up a .NET project from scratch using Visual Studio. This guide covers adding an ASP.NET Core web API project, setting up code style enforcement, build configuration, centralized package management, code quality checks, containerization with Docker, and continuous integration using GitHub Actions.

  4. 4
    Video
    Avatar of nickchapsasNick Chapsas·1y

    Everything a .NET Developer Needs to Know in 2025

    A detailed guide for .NET developers outlining essential skills and tools for 2025. It emphasizes varying levels of knowledge based on experience from junior to principal levels. Highlights include the importance of version control with Git, the use of modern IDEs like Visual Studio and Rider, new features in .NET 9, and the increasing relevance of AI with tools like ChatGPT. Additional recommendations cover databases, testing frameworks, caching strategies, and architecture paradigms.

  5. 5
    Article
    Avatar of milanjovanovicMilan Jovanović·1y

    Working with LLMs in .NET using Microsoft.Extensions.AI

    Learn how to integrate Large Language Models (LLMs) into .NET applications using Microsoft.Extensions.AI. This guide covers configuring Ollama for local execution, setting up dependency injection for chat completion, building interactive chats with history, summarizing articles, and applying smart categorization. It also details switching between various LLM providers like Azure OpenAI and OpenAI for flexible development and production solutions.

  6. 6
    Article
    Avatar of devtoDEV·1y

    Learn ASP.NET from Scratch

    Learn ASP.NET Core through a 17-module structured learning path. This guide assumes a basic knowledge of C# and covers topics such as the dotnet CLI, ASP.NET application structure, dependency injection, creating APIs, connecting to PostgreSQL, understanding MVC, using Razor views, and more. Each module comes with specific goals and curated resources to help you master ASP.NET Core development.

  7. 7
    Article
    Avatar of godotGodot·1y

    Godot C# packages move to .NET 8

    Godot 4.4 will now target .NET 8, updating from .NET 6 which ends support in November 2024. Existing Godot projects will be automatically upgraded to target .NET 8 when opened with Godot 4.4. Users are encouraged to upgrade to the latest version of Godot to benefit from the latest fixes and improvements.

  8. 8
    Article
    Avatar of communityCommunity Picks·1y

    .NET Digest #5

    The latest .NET Digest introduces .NET 9, released on November 12, featuring numerous performance and security improvements. Highlights include new params collections in C# 13, nullable reference types in F# 9, and significantly faster package restores with the new NuGet resolver. Articles cover top .NET blog posts, the .NET Aspire Community Toolkit, and notable bugs in C# projects detected in 2024. It also discusses updates in tools like PVS-Studio, dotCover, dotMemory, dotPeek, dotTrace, and ReSharper.

  9. 9
    Article
    Avatar of milanjovanovicMilan Jovanović·1y

    Unit Testing Clean Architecture Use Cases

    Writing quality tests is crucial for the success of any software project. This guide focuses on unit testing Clean Architecture use cases in .NET. It explains the importance of testing, different types of tests, and provides specific examples using a typical apartment booking reservation system. Key points include the use of mocks, handling success and failure scenarios, verifying exception handling, and understanding the limitations of test coverage. Good tests act as documentation and help catch issues early, providing confidence in the code.

  10. 10
    Article
    Avatar of dotnetsquad.NET·1y

    EF !be honest

  11. 11
    Article
    Avatar of elmahelmah.io·1y

    Comparing Records, Structs, and Classes in C#: When to Use What?

    C# offers three main type declarations: classes, structs, and records. Classes are reference types that support object-oriented principles and are ideal for complex data objects. Structs are value types meant for simple, lightweight data structures with no inheritance, making them efficient for value-based comparisons. Records, introduced in C# 9.0, combine features of both classes and structs; they are immutable reference types and provide concise syntax for type declarations. Each type serves distinct scenarios and optimizes specific use-cases.

  12. 12
    Article
    Avatar of milanjovanovicMilan Jovanović·1y

    Implementing AES Encryption With C#

    Learn how to implement AES encryption in .NET with practical code examples for both encryption and decryption. Understand the differences between symmetric and asymmetric encryption, and get insights into secure key management and best practices for protecting sensitive data like API keys and database credentials.

  13. 13
    Article
    Avatar of communityCommunity Picks·1y

    Bugs and suspicious places in .NET 9 source code

    The post highlights various bugs and suspicious code fragments found in the .NET 9 source code, analyzed using the PVS-Studio static analyzer. It describes specific instances of incorrect usage, such as improper reference comparisons, potential NullReferenceExceptions, and logical errors, explaining how these issues can affect the code. The post encourages developers to use static analysis tools to detect and fix bugs in their projects.

  14. 14
    Article
    Avatar of gcgitconnected·1y

    Building Dynamic Business Logic with JSON-based Rules Engine in .NET

    Developers often need their software to exhibit different behaviors under varying conditions. This post explains how to implement a dynamic business logic using a JSON-based rules engine in .NET. By storing rules in JSON and using Microsoft's RulesEngine package, applications can adapt to changing requirements without redeployment. The post also includes a practical guide on setting up the rules engine, handling complex conditions, and integrating custom methods for flexibility.

  15. 15
    Video
    Avatar of nickchapsasNick Chapsas·1y

    Why is .NET so Insanely Fast? with Stephen Toub

    Nick engages in a detailed discussion with Stephen Toub, a Partner Software Engineer at Microsoft, about the performance improvements in .NET 9, including the integration of AI and the advancements in Profile Guided Optimization (PGO). They also cover the impact of open-source contributions on .NET's performance and explore the evolution of API usability and performance in .NET Core.

  16. 16
    Video
    Avatar of communityCommunity Picks·1y

    Event Sourcing for .NET Developers: From Zero to Implementation

    Event sourcing is a design pattern where changes in a domain are stored as immutable events in an append-only log. By focusing on events instead of state, event sourcing allows the reconstruction of current state through replaying events. Key concepts include events, streams, and projections. The tutorial covers implementing an event-sourced bank account aggregate in .NET, detailing event creation, application, and replaying events to achieve current state.

  17. 17
    Video
    Avatar of nickchapsasNick Chapsas·1y

    The New Way to Seed Your Database in .NET 9

    Learn about the new database seeding approach introduced in .NET 9 using EF Core 99. The post includes a step-by-step guide, highlights the importance of managing the seed process to avoid concurrency issues, and addresses the use of synchronization methods for effective data seeding.

  18. 18
    Video
    Avatar of zoranhorvatZoran Horvat·1y

    Are You Using the Extended LINQ Operators?

    The post discusses advanced LINQ operators: SelectMany, Zip, and GroupBy. It demonstrates how these operators can simplify complex data queries and transformations in C#. Detailed examples show how to use specific overloads to reduce intermediate steps and enhance code efficiency.

  19. 19
    Article
    Avatar of codemazeCode Maze·1y

    Testing Database Connectivity with EF Core

    Verifying database connectivity is crucial for application reliability and user experience. This post outlines two approaches to test database availability with EF Core: using the CanConnectAsync() method for application-level checks and the DbContext check with ASP.NET Core health checks framework for infrastructure-level monitoring. It also includes setup instructions for using a SQL Server Test Container and Docker.

  20. 20
    Article
    Avatar of newstackThe New Stack·1y

    Duck DB: Query Processing Is King

    DuckDB is an in-process database that simplifies query processing without focusing on data persistence. It supports multiple programming languages and is efficient for testing scenarios and on-the-fly data transformations. DuckDB is especially useful for gaining SQL query support without the need for a full database system.

  21. 21
    Video
    Avatar of nickchapsasNick Chapsas·1y

    Create Clean Collections in C#

    C# 12 introduces new collection initializers that simplify the process of defining collections. Using two square brackets, your code becomes cleaner and more efficient, removing the need for extensive code to set up arrays, lists, or dictionaries.

  22. 22
    Video
    Avatar of nickchapsasNick Chapsas·1y

    The Smallest C# Program Possible | .NET Tips 14

    C# 9 introduced top-level statements, removing the need for the 'public static void main(string[] args)' method in program.cs. This allows writing code as if already inside the main method. The smallest valid C# program leverages this feature.

  23. 23
    Video
    Avatar of nickchapsasNick Chapsas·1y

    The Only Cache You Should Be Using in .NET

    Fusion cache is recommended over the new hybrid cache in .NET 9, which is not yet fully available. Fusion cache offers effective L1 plus L2 caching capabilities, allowing for both in-memory and distributed caching. It simplifies caching by providing features like tag-based cache invalidation and integrates smoothly with existing .NET infrastructure. Fusion cache is proven in production and is available as an open-source library.

  24. 24
    Article
    Avatar of logrocketLogRocket·1y

    Using Firebase for ASP.NET authentication

    Combining Firebase and ASP.NET can create a secure and high-performing web application. This guide provides an end-to-end solution for securing APIs, enabling interactive login functionality, and handling access and refresh tokens. The step-by-step instructions include setting up Firebase, configuring ASP.NET authentication, validating JWTs, and integrating a demo Angular frontend to use the authentication system. By following these steps, you can create a seamless and secure authentication system for your web application.