Best of .NETOctober 2024

  1. 1
    Article
    Avatar of mwaseemzakirWaseem .NET Newsletter·2y

    Top 18 Essential .NET Libraries for Developers

    A guide to 18 essential .NET libraries for developers, detailing their use cases, benefits, and trivia. Libraries include Mediator for CQRS, Dapper for micro-ORM, Serilog for logging, and more. Each library is briefly explained with implementation links provided.

  2. 2
    Video
    Avatar of nickchapsasNick Chapsas·2y

    Swagger is Gone in .NET 9! Replace It With This.

    Swagger has been removed in .NET 9 and replaced with Microsoft's built-in OpenAPI functionalities. To adapt to this change, developers can use the 'app.mapOpenAPI' call for API documentation without a UI. Alternatively, they can integrate third-party tools such as Swashbuckle to restore the Swagger UI, or use Scaler, which offers a modern and customizable API documentation UI. Scaler provides various themes and integration options, including dark mode and authentication schemes, making it a versatile alternative.

  3. 3
    Article
    Avatar of communityCommunity Picks·2y

    What's new in C# 13: overview

    C# 13 introduces several noteworthy updates including object initialization using 'from the end' index, partial properties and indexers, support for collections with the 'params' modifier, and a new OverloadResolutionPriorityAttribute to prioritize method overloads. Other enhancements include a new Lock class for better thread synchronization, a new escape sequence character '\e', improvements in method group natural type handling, and expanded usage of 'ref struct' in async and iterator methods. These changes aim to simplify code readability and offer more robust control for developers.

  4. 4
    Video
    Avatar of freecodecampfreeCodeCamp·2y

    ASP.NET Core MVC Course for Beginners (.NET 9)

    In this crash course on ASP.NET Core MVC and Entity Framework Core, you will learn from scratch about the MVC app structure, how to work with databases using Entity Framework Core, and the essential concepts required for developing applications using the latest .NET version (9). The course covers breaking down the MVC architecture, working with models, views, and controllers, and includes practical steps to download, install, and configure .NET 9 and Visual Studio.

  5. 5
    Article
    Avatar of atomicobjectAtomic Spin·2y

    Optimize EF Core Database Query Performance

    In a project where PDFs were migrated from a Blob Storage container to a SQL Server database, the web app's performance dropped significantly. To address this, several strategies were used to optimize EF Core query performance: using AsSplitQuery to avoid data duplication, employing projections and DTOs for read-only data to retrieve only necessary columns, and creating indexes for frequently queried non-primary key fields. These optimizations led to a reduction in response times and overall improved performance.

  6. 6
    Article
    Avatar of advanceddotnetAdvanced .NET·2y

    How did you guys get into C#/.NET? Do you think it is a solid option for most projects?

    The author shares their journey of learning C# through Unity and continuing with .NET for other applications. With experience in multiple programming languages, the author believes C# offers an optimal balance of simplicity, safety, and speed. The introduction of top-level statements has made C# more appealing for scripting tasks previously handled with Python.

  7. 7
    Article
    Avatar of hnHacker News·2y

    .NET 9.0 LINQ Performance Improvements

    NET 9.0 offers significant performance improvements to LINQ, particularly through the use of TryGetSpan() which enhances iteration over arrays and lists. These optimizations include the introduction of specialized iterators for common LINQ call chains, leading to more efficient execution of methods like Count(), First(), and Last(). Additionally, SIMD is utilized for operations like summing integers, and the overhead for empty sequence enumeration is reduced. Understanding and implementing these changes can yield noticeable performance gains in your code.

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

    Problem Details for ASP.NET Core APIs

    Providing consistent and informative error responses is crucial for a smooth developer experience in HTTP APIs. Problem Details in ASP.NET Core offers a standardized solution, making it easier to communicate errors effectively. The latest updates include RFC 9457, new global exception handling with .NET 8's IExceptionHandler, and customizable error responses using IProblemDetailsService. This guide covers implementing Problem Details, global error handling strategies, and customizing error responses to improve API error management.

  9. 9
    Article
    Avatar of infoworldInfoWorld·2y

    Microsoft releases official OpenAI library for .NET

    Microsoft has released an official OpenAI library for .NET, offering full REST API support and compatibility with flagship models like GPT-4o. Available via NuGet, the library includes sync/async APIs, streaming completions, and .NET Standard 2.0 compatibility. It supports extensibility and aims to ensure seamless integration with OpenAI and Azure OpenAI services.

  10. 10
    Article
    Avatar of freecodecampfreeCodeCamp·2y

    How to Use Conditional Statements in C#: If, Switch, and More Explained with Example Code

    This post covers various conditional coding mechanisms in C# including if/else statements, ternary operators, and switch-case statements. It explains their syntaxes, provides example code, and discusses performance considerations and appropriate use cases for each method. Additionally, it explores switch-case expressions introduced in C# 8 and benchmarks the performance of different conditional techniques.

  11. 11
    Video
    Avatar of communityCommunity Picks·2y

    Building Change Data Capture (CDC) in .NET with Debezium + RabbitMQ

    Milan introduces Change Data Capture (CDC), which tracks and reacts to database changes in real-time or near-real-time. He covers setting up CDC with PostgreSQL, RabbitMQ, and MassTransit in a .NET application. The guide includes configuring Docker containers, setting environment variables, and using transformations in Debezium to route messages accurately. Despite initial challenges, the setup enables streaming database changes to RabbitMQ, which are then consumed by a .NET app.

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

    Implementing the Outbox Pattern

    The Outbox Pattern addresses the challenge of maintaining data consistency in distributed systems by ensuring atomicity between database operations and message publication. This pattern saves messages to an Outbox table within the same database transaction and later publishes them via a separate process, ensuring at-least-once delivery. Implementation details, such as creating the Outbox table and a processing job using Quartz, are discussed along with considerations for scalability, idempotency, and database performance.

  13. 13
    Article
    Avatar of dotnet.NET Blog·2y

    Announcing the stable release of the official OpenAI library for .NET

    The stable release of the official OpenAI library for .NET is now available, providing developers with robust tools to integrate OpenAI models into their .NET applications. Key features include full OpenAI REST API support, compatibility with the latest models, extensibility, sync and async APIs, streaming completions, quality-of-life improvements, and .NET Standard 2.0 compatibility. The library is open-source and maintained on GitHub.

  14. 14
    Article
    Avatar of dotnet.NET Blog·2y

    .NET 9 Release Candidate 2 is now available!

    The .NET 9 Release Candidate 2 is now available with enhanced performance, stability, and optimizations ahead of its general availability release in November. This version includes updates to libraries, runtime, SDK, ASP.NET Core, and .NET MAUI. Developers are encouraged to try out this latest release and provide feedback. Key resources such as release notes, installation guides, and GitHub discussion links are provided.

  15. 15
    Article
    Avatar of lemireDaniel Lemire·2y

    How fast can you parse a CSV file in C#? – Daniel Lemire's blog

    Explores different methods of parsing large CSV files in C#, comparing the performance of CsvHelper and NReco.Csv libraries, and demonstrating a low-level approach that significantly boosts parsing speed on a .NET 9 system with an Apple M2 processor.

  16. 16
    Article
    Avatar of codemazeCode Maze·2y

    How to Get an Instance of IServiceProvider in .NET

    In modern .NET applications, understanding how to obtain and use an instance of IServiceProvider is crucial for effective dependency injection, which promotes loose coupling and enhances maintainability. This post outlines various methods to get an instance of IServiceProvider, including during application startup, within service classes, controllers, and unit tests. It also discusses best practices and common pitfalls, emphasizing the importance of proper service lifecycle management and the benefits of constructor injection over direct service resolution.

  17. 17
    Video
    Avatar of nickchapsasNick Chapsas·2y

    How to Measure Time Correctly in .NET

    Nick explains the correct method to measure elapsed time in .NET applications, emphasizing that using DateTime.UtcNow is incorrect due to performance issues. He demonstrates how to implement accurate time measurement using the Stopwatch class and introduces the more efficient Stopwatch.GetTimestamp method available in .NET 7. This method avoids unnecessary allocations and provides precise time measurements by interacting directly with the operating system's low-level functions.

  18. 18
    Article
    Avatar of csharpcornerC# Corner·2y

    How Select and SelectMany Works in C#

    Select in LINQ projects each element of a sequence into a new form, transforming elements in a collection. SelectMany projects each element to an IEnumerable<T> and flattens the resulting sequences into one, useful for collections of collections.

  19. 19
    Article
    Avatar of andrewlock.NET Escapades·2y

    Replacing Exceptions-as-flow-control with the result pattern

    The post discusses the inefficiencies of using exceptions for flow control in .NET applications and introduces the result pattern as a more efficient alternative. It starts with a simple API implementation without error handling, adds exceptions for common error cases, and then replaces these exceptions with a Result<T> type to demonstrate the result pattern. However, the initial implementation of the result pattern is cumbersome, leading to the next post in the series where the pattern will be simplified further.

  20. 20
    Video
    Avatar of communityCommunity Picks·2y

    The Last Amazon S3 Video You'll Need To Watch (Presigned URLs, Multipart Upload)

    Learn best practices for working with Amazon S3 from a .NET application. This guide covers using the S3 SDK, working with pre-signed URLs, and handling multi-part uploads for large files. Practical tips include navigating the AWS console, configuring S3 buckets, and implementing efficient file upload and download functionalities. Explore examples on configuring CORS and using client-side applications for direct file interactions with S3.

  21. 21
    Article
    Avatar of amplicationAmplication·2y

    Streamlining Backend Development: Reducing Technical Debt and Preventing Template Drift

    Internal Developer Platforms (IDPs) like Backstage, Port, Spotify Portal, and Cortex help streamline workflows and reduce technical debt by standardizing service creation. However, they often fail to maintain alignment with evolving standards, leading to template drift and increased technical debt. Amplication offers a proactive solution with live templates, AI-powered code generation, and automatic maintenance to ensure consistency and compliance. It integrates seamlessly with existing IDPs or can be used as a standalone platform to keep services up-to-date, reducing the manual effort associated with maintaining standards.

  22. 22
    Video
    Avatar of nickchapsasNick Chapsas·2y

    Adding JWT Authentication for Production in .NET

    Nick demonstrates implementing JWT (JSON Web Token) authentication in .NET applications, focusing not just on simple integration but also on more advanced scenarios with third-party services like AWS Cognito. He covers how to generate and validate JWTs, using AWS Cognito for user management and token generation, and integrating this with a .NET API to secure endpoints. Additionally, examples include setting up Cognito user pools and handling both basic token validation and more complex authentication flows.

  23. 23
    Video
    Avatar of communityCommunity Picks·2y

    Full Text Search in .NET With PostgreSQL and EF Core

    Learn how to implement full text search in a .NET application using PostgreSQL and EF Core, without relying on external services like Elasticsearch or Solr. This guide walks through creating a search endpoint, handling case sensitivity, improving performance with indexes, and ranking search results for relevance. Additionally, it covers optimizing database queries for performance with full text search capabilities.

  24. 24
    Article
    Avatar of andrewlock.NET Escapades·2y

    Is the result pattern worth it?

    The post concludes a series discussing the use of the result pattern over exceptions for flow control in C#. It highlights how LINQ can simplify nested lambda methods, improving readability. The discussion contrasts heavy and lightweight versions of the result pattern with perspectives from industry experts. It addresses the argument for substituting exceptions with the result pattern and presents LINQ as a readable but complex alternative for error handling. The post suggests that while LINQ can simplify code, developers must evaluate whether its complexity is justified in their specific use cases.

  25. 25
    Article
    Avatar of codemazeCode Maze·2y

    Publish MediatR Notifications in Parallel

    Explore how to publish MediatR notifications in parallel, starting with the default sequential publishing strategy. Learn how to implement parallel publishing using newer MediatR features, create test notifications and handlers, and configure dependency injection. Understand the pros and cons of parallel publishing, including performance benefits and potential pitfalls like ThreadPool starvation and race conditions.