<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ahmed Shah</title>
    <description>The latest articles on Forem by Ahmed Shah (@ahmedshahjr).</description>
    <link>https://forem.com/ahmedshahjr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F290153%2F2df0df8f-76fa-4a86-a709-8fef341fec5b.jpg</url>
      <title>Forem: Ahmed Shah</title>
      <link>https://forem.com/ahmedshahjr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ahmedshahjr"/>
    <language>en</language>
    <item>
      <title>MIDDLEWARE BEST PRACTICES 💪</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Tue, 02 Sep 2025 17:17:53 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/middleware-best-practices-4k3b</link>
      <guid>https://forem.com/ahmedshahjr/middleware-best-practices-4k3b</guid>
      <description>&lt;p&gt;MIDDLEWARE BEST PRACTICES 💪✅ Keep middleware focused (single responsibility)✅ Order matters - plan your pipeline✅ Use built-in before custom✅ Always call next() or terminate✅ Handle exceptions gracefully&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle0tw43oyr8y91z5yipa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle0tw43oyr8y91z5yipa.png" alt=" " width="800" height="646"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb99lkbd1x6u62fllf0dg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb99lkbd1x6u62fllf0dg.png" alt=" " width="800" height="798"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27w8ixi96qpfszvyv0x9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27w8ixi96qpfszvyv0x9.png" alt=" " width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fznq0waan4glpf8aih6cd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fznq0waan4glpf8aih6cd.png" alt=" " width="800" height="879"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frhhr2nrnmvz0jh05j3ho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frhhr2nrnmvz0jh05j3ho.png" alt=" " width="800" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu46uf5j5dc1nwou301x9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu46uf5j5dc1nwou301x9.png" alt=" " width="800" height="804"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ry8414hqox57k5zk61t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ry8414hqox57k5zk61t.png" alt=" " width="800" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpy8z0eqe0lwhscc99uf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpy8z0eqe0lwhscc99uf.png" alt=" " width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Introducing Rejigs: A Developer-Friendly Regex Builder for .NET</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Mon, 14 Jul 2025 09:25:54 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/introducing-rejigs-a-developer-friendly-regex-builder-for-net-112b</link>
      <guid>https://forem.com/ahmedshahjr/introducing-rejigs-a-developer-friendly-regex-builder-for-net-112b</guid>
      <description>&lt;p&gt;Regex is powerful — but let’s be honest, it’s also painful.&lt;br&gt;
Too cryptic, too easy to break, and let’s not even talk about debugging them. &lt;/p&gt;

&lt;p&gt;That’s why I use Rejigs — a NuGet package that lets you build, chain, and manage regular expressions using readable, fluent syntax.&lt;br&gt;
Easy to use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lpxs4dnravet7nmsrsj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lpxs4dnravet7nmsrsj.png" alt=" " width="800" height="496"&gt;&lt;/a&gt;&lt;br&gt;
✨ Key Features:&lt;br&gt;
✅ Fluent interface (.StartOfLine().Then("hello").Maybe("world").EndOfLine())&lt;br&gt;
✅ Easy to read, build, and maintain regex patterns&lt;br&gt;
✅ No more trial-and-error spaghetti strings&lt;/p&gt;

&lt;p&gt;Available on =&amp;gt; nuget.org/packages/Rejigs&lt;/p&gt;

&lt;p&gt;=&amp;gt; Do you still write raw regex in your apps?&lt;br&gt;
=&amp;gt; Would a tool like this simplify your workflow?&lt;/p&gt;

&lt;p&gt;Drop your thoughts, ideas, or brutal regex horror stories in the comments!&lt;br&gt;
Let’s make regex less scary — one pattern at a time.&lt;/p&gt;

&lt;h1&gt;
  
  
  dotnet #csharp #regex #NuGet #opensource #developerexperience #fluentapi
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>ai</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Add an .editorconfig file to your solution right from the start! 🛠️</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Sun, 20 Apr 2025 08:47:47 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/add-an-editorconfig-file-to-your-solution-right-from-the-start-5lf</link>
      <guid>https://forem.com/ahmedshahjr/add-an-editorconfig-file-to-your-solution-right-from-the-start-5lf</guid>
      <description>&lt;p&gt;Whenever Starting a new project Add an .editorconfig file to your solution right from the start! 🛠️&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;An EditorConfig file ensures every developer on your team follows the same coding conventions—whether they use Visual Studio, VS Code, Rider, or another IDE. It’s like a rulebook for your codebase, eliminating debates over tabs vs. spaces, indentation, naming, or formatting.&lt;/p&gt;

&lt;p&gt;Key Benefits for Your Team:&lt;/p&gt;

&lt;p&gt;=&amp;gt; Consistency First: Enforce coding styles (e.g., indent size, line endings, charset) across all files and contributors.&lt;/p&gt;

&lt;p&gt;=&amp;gt; Fewer Code Review Hassles: Reduce time spent arguing over formatting. Focus on logic and architecture instead!&lt;/p&gt;

&lt;p&gt;=&amp;gt; IDE-Agnostic: Works seamlessly with most editors—no more "But my IDE auto-formatted it!" excuses.&lt;/p&gt;

&lt;p&gt;=&amp;gt; Built-In .NET Core Support: .NET SDKs natively recognize .editorconfig, making it easy to align with compiler warnings or code analysis rules.&lt;/p&gt;

&lt;p&gt;=&amp;gt; Version Control Friendly: Commit the file to your repo, and everyone stays in sync.&lt;/p&gt;

&lt;p&gt;How to Add It in 2 Minutes:&lt;/p&gt;

&lt;p&gt;In Visual Studio: Right-click your project → Add → New Item → Search for “.editorconfig” → Choose the template.&lt;/p&gt;

&lt;p&gt;Manually: Create a .editorconfig file at the solution root and define your rules.&lt;/p&gt;

&lt;h1&gt;
  
  
  DotNetCore #CodingStandards #DeveloperTips #SoftwareEngineering #TechCommunity #CleanCode #DevOps
&lt;/h1&gt;

&lt;p&gt;Let’s build cleaner, more maintainable codebases—one config file at a time! 🚀&lt;/p&gt;

&lt;p&gt;Example Snippet:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00mlho7yrhgbrcavdinw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00mlho7yrhgbrcavdinw.png" alt="Image" width="636" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>ai</category>
    </item>
    <item>
      <title>🚀 Mastering Filters in ASP.NET Core</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Wed, 16 Oct 2024 04:04:06 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/mastering-filters-in-aspnet-core-5d97</link>
      <guid>https://forem.com/ahmedshahjr/mastering-filters-in-aspnet-core-5d97</guid>
      <description>&lt;p&gt;Mastering Filters in ASP.NET Core.&lt;/p&gt;

&lt;p&gt;If you're working with ASP.NET Core, you're likely already familiar with controllers and actions, but have you explored filters yet? Filters in ASP.NET Core are an incredibly powerful feature that allow you to add functionality before or after an action method is executed, making them perfect for cross-cutting concerns like logging, error handling, and authorization. 🔍&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hdg089kkiq31dedu90l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hdg089kkiq31dedu90l.png" alt="Image description" width="148" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Authorization Filters&lt;br&gt;
Purpose: Check if the user is authorized to access a resource.&lt;br&gt;
Example: [Authorize] attribute.&lt;br&gt;
Usage: Can be applied globally, to controllers, or to specific actions.&lt;/p&gt;

&lt;p&gt;Resource Filters&lt;br&gt;
Purpose: Run code before and after the execution of the rest of the pipeline. Often used for caching.&lt;br&gt;
Example: Implementing IResourceFilter.&lt;br&gt;
Usage: Executes after authorization but before model binding.&lt;/p&gt;

&lt;p&gt;Action Filters&lt;br&gt;
Purpose: Run code before and after an action method executes.&lt;br&gt;
Example: [OnActionExecuting] and [OnActionExecuted] attributes.&lt;br&gt;
Usage: Ideal for logging, validation, or modifying the action result.&lt;/p&gt;

&lt;p&gt;Exception Filters&lt;br&gt;
Purpose: Handle exceptions thrown by action methods or other filters.&lt;br&gt;
Example: Implementing IExceptionFilter.&lt;br&gt;
Usage: Great for global exception handling strategies, such as logging or custom error responses.&lt;/p&gt;

&lt;p&gt;Result Filters&lt;br&gt;
Purpose: Run code before and after the execution of action results.&lt;br&gt;
Example: [OnResultExecuting] and [OnResultExecuted] attributes.&lt;br&gt;
Usage: Useful for modifying the response, e.g., adding headers or changing the result.&lt;/p&gt;

&lt;p&gt;Why are filters a game-changer?&lt;/p&gt;

&lt;p&gt;Because they help you keep your code DRY (Don't Repeat Yourself) and maintainable! 🙌&lt;/p&gt;

&lt;p&gt;If you're looking to simplify your ASP.NET Core development, it’s time to explore the power of filters!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>🚀 Secure your .NET Apps with Visual Studio! 🚀</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Sun, 22 Sep 2024 06:30:00 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/secure-your-net-apps-with-visual-studio-2m4n</link>
      <guid>https://forem.com/ahmedshahjr/secure-your-net-apps-with-visual-studio-2m4n</guid>
      <description>&lt;p&gt;As developers, ensuring the security of our applications is paramount. Did you know that Visual Studio has a feature to help you identify vulnerable packages in your projects? &lt;/p&gt;

&lt;p&gt;By using the “Show only vulnerable packages” option in the NuGet Package Manager, you can quickly pinpoint and address any security issues in your dependencies. &lt;/p&gt;

&lt;p&gt;This feature leverages data from the GitHub Advisory Database to alert you about known vulnerabilities, making it easier to keep your projects secure and up-to-date.&lt;/p&gt;

&lt;p&gt;How to Use It:&lt;/p&gt;

&lt;h1&gt;
  
  
  Open your project in Visual Studio.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Navigate to the NuGet Package Manager.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Check the “Show only vulnerable packages” option.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Review the listed packages and update or replace them as needed.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Stay ahead of potential security threats and ensure your software is robust and reliable. Happy coding! 💻✨
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm97woxh7djmi8ormv6zw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm97woxh7djmi8ormv6zw.png" alt="Image description" width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  VisualStudio #NuGet #CyberSecurity #DevSecOps #SoftwareDevelopment
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>🚀 TrueForAll in C# 🚀</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Tue, 17 Sep 2024 10:18:21 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/trueforall-in-c-4hd6</link>
      <guid>https://forem.com/ahmedshahjr/trueforall-in-c-4hd6</guid>
      <description>&lt;p&gt;We often encounter scenarios where we need to check if all elements in a collection meet a specific condition. &lt;br&gt;
That’s where TrueForAll comes in, offering a cleaner, more efficient way to handle these checks simplicity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx9xqqbv28b5wa3uu5i54.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx9xqqbv28b5wa3uu5i54.png" alt="Image description" width="630" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🚀 Unlock Your Business Potential with Keyed Services Implementation in .NET Core! 🚀</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Wed, 11 Sep 2024 09:31:31 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/unlock-your-business-potential-with-keyed-services-implementation-in-net-core-4p9f</link>
      <guid>https://forem.com/ahmedshahjr/unlock-your-business-potential-with-keyed-services-implementation-in-net-core-4p9f</guid>
      <description>&lt;p&gt;Are you looking to optimize your application architecture and enhance scalability? Keyed Services in .NET Core might be the game-changer you need! 🔑💻&lt;/p&gt;

&lt;p&gt;Keyed Services in .NET Core provide a robust way to manage dependencies and improve the service selection of your application. By leveraging this powerful feature, you can:&lt;/p&gt;

&lt;p&gt;✨ Boost Scalability: Ensure your services can handle growing loads efficiently. &lt;br&gt;
🔧 Enhance Flexibility: Tailor service implementations based on specific needs or contexts. &lt;br&gt;
⚙️ Improve Maintainability: Simplify updates and management of complex service dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define the Interface and Classes Where it needs to implemented
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegf65sjntnow2yr7g28f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegf65sjntnow2yr7g28f.png" alt="Interface Defination" width="800" height="672"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inject in the Program.cs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3prmuvzy634b4m7tt8gd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3prmuvzy634b4m7tt8gd.png" alt="Program Injection" width="800" height="852"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inject the Service in you specified Controller or Service
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb8e1p5px5h2fckwndbr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb8e1p5px5h2fckwndbr.png" alt="Main Service" width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice in the constructor we are passing the key for the required service we want to use. we can move it to app settings and use it using the IOptions Pattern also.&lt;br&gt;
This approach allows you to manage multiple implementations of a service and choose the appropriate one at runtime based on a key.&lt;/p&gt;

&lt;p&gt;Let Run the Project using Outlook Service and See the Results.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r6wo0gjpyb6hbo18ez6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1r6wo0gjpyb6hbo18ez6.png" alt="Outlook Response" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;we can see the message return from the Outlook Service.&lt;/p&gt;

&lt;p&gt;Let Change the Key to Gmail Service and Hot Reload Our Project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F444vvlrl8ob2ytp5k7aa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F444vvlrl8ob2ytp5k7aa.png" alt="Gmail Response" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the Response changed to Outlook Service.&lt;/p&gt;

&lt;p&gt;This Key can be changed using iOptions pattern. you can see my previous article how to use  it. Link to the atricle&lt;br&gt;
&lt;a href="https://dev.to/ahmedshahjr/introduction-to-ioptions-pattern-in-net-8-58l4"&gt;IOptions Pattern&lt;/a&gt;&lt;br&gt;
Code For Current Article&lt;br&gt;
&lt;a href="https://github.com/ahmedshahjr/Articles/tree/main/KeyedServices" rel="noopener noreferrer"&gt;Keyed Services GIthubLink&lt;/a&gt;&lt;br&gt;
🔍 #DotNetCore #KeyedServices #SoftwareDevelopment #ApplicationArchitecture #Scalability #CrossPlatform #PerformanceOptimization #TechInnovation #Programming #DevCommunity #CodingBestPractices&lt;/p&gt;

&lt;p&gt;Feel free to connect if you want to dive deeper into how Keyed Services can be implemented in your projects or if you need any guidance on .NET Core!&lt;/p&gt;

&lt;p&gt;💬 Drop a comment or DM me to discuss!&lt;/p&gt;

&lt;h1&gt;
  
  
  TechTalk #ProgrammingTips #SoftwareEngineering #DotNetCoreDevelopment #CodeOptimization
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🔍 𝗘𝘅𝗽𝗹𝗼𝗿𝗶𝗻𝗴 𝘁𝗵𝗲 𝗕𝗲𝗻𝗲𝗳𝗶𝘁𝘀 𝗼𝗳 𝗘𝗻𝘂𝗺𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝘀 𝘄𝗶𝘁𝗵 𝗘𝘅𝗽𝗹𝗶𝗰𝗶𝘁 𝗩𝗮𝗹𝘂𝗲𝘀 𝗶𝗻 𝗣𝗿𝗼𝗴𝗿𝗮𝗺𝗺𝗶𝗻𝗴</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Sat, 10 Aug 2024 10:54:44 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/-3fk2</link>
      <guid>https://forem.com/ahmedshahjr/-3fk2</guid>
      <description>&lt;p&gt;𝗻𝘂𝗺𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝘀 are a powerful tool in many programming languages, allowing us to assign names to a set of related values. But why should we consider assigning explicit numbers to these values? Here are a few reasons:&lt;/p&gt;

&lt;p&gt;𝗥𝗲𝗮𝗱𝗮𝗯𝗶𝗹𝗶𝘁𝘆 𝗮𝗻𝗱 𝗨𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱𝗶𝗻𝗴&lt;br&gt;
Enums with numbers can improve code readability. When we assign explicit numbers to enums, it becomes easier to understand the significance of each value, especially when these numbers have a specific meaning attached to them&lt;/p&gt;

&lt;p&gt;𝗦𝘁𝗮𝗯𝗶𝗹𝗶𝘁𝘆 𝗔𝗰𝗿𝗼𝘀𝘀 𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝘁 𝗩𝗲𝗿𝘀𝗶𝗼𝗻𝘀&lt;br&gt;
 If your software undergoes multiple versions and the enum values are stored in a database, using numbers can ensure stability. Even if you add, remove, or reorder enum members, the underlying values in the database remain consistent&lt;/p&gt;

&lt;p&gt;𝗜𝗻𝘁𝗲𝗿𝗼𝗽𝗲𝗿𝗮𝗯𝗶𝗹𝗶𝘁𝘆 𝘄𝗶𝘁𝗵 𝗢𝘁𝗵𝗲𝗿 𝗦𝘆𝘀𝘁𝗲𝗺𝘀&lt;br&gt;
 When working with external systems that rely on specific numeric values, using enums with numbers can simplify the integration process and reduce potential errors&lt;/p&gt;

&lt;p&gt;𝗘𝗮𝘀𝗲 𝗼𝗳 𝗗𝗲𝗯𝘂𝗴𝗴𝗶𝗻𝗴&lt;br&gt;
 During debugging, it's often easier to spot an incorrect number than an incorrect string. This can make the debugging process more efficient&lt;/p&gt;

&lt;p&gt;hashtag#Programming hashtag#CodingBestPractices hashtag#Enums hashtag#CodeReadability hashtag#SoftwareDevelopment hashtag#CodeMaintenance hashtag#CSharp hashtag#DeveloperCommunity&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5i70r6wf5wa7gs4pcl1p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5i70r6wf5wa7gs4pcl1p.png" alt="Image description" width="716" height="1194"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Improve Your C# Code with Pattern Matching! 🚀</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Sun, 28 Jul 2024 15:41:44 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/improve-your-c-code-with-pattern-matching-5g7c</link>
      <guid>https://forem.com/ahmedshahjr/improve-your-c-code-with-pattern-matching-5g7c</guid>
      <description>&lt;p&gt;🛑 Avoid complex nested if-else statements&lt;br&gt;
✅ Use pattern matching with switch expressions&lt;/p&gt;

&lt;p&gt;Which approach do you prefer? Share your thoughts and let's discuss the benefits of using pattern matching in C#!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiam1bbq60z1i2to67osy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiam1bbq60z1i2to67osy.png" alt="Image description" width="800" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>🚫 Stop the Madness!! Use Cancellation Tokens Effectively in .NET Core🚫</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Wed, 24 Jul 2024 03:59:41 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/stop-the-madness-use-cancellation-tokens-effectively-in-net-core-2mln</link>
      <guid>https://forem.com/ahmedshahjr/stop-the-madness-use-cancellation-tokens-effectively-in-net-core-2mln</guid>
      <description>&lt;p&gt;Ever get that sinking feeling when your .NET Core app gets stuck in a long-running operation, leaving users frustrated and resources wasted? &lt;/p&gt;

&lt;p&gt;As developers, we often encounter long-running tasks in our applications. Whether it's an API call, a file upload, or a complex calculation, these tasks can sometimes hang or take longer than expected. This is where the power of CancellationToken in .NET Core comes in.&lt;/p&gt;

&lt;p&gt;What Are Cancellation Tokens?&lt;/p&gt;

&lt;p&gt;A CancellationToken is a lightweight object in ASP.NET Core that facilitates cooperative cancellation between threads or components. When a CancellationTokenSource is canceled (usually due to user input or a timeout), all consumers of the associated cancellation token are notified.&lt;/p&gt;

&lt;p&gt;Why Use Cancellation Token?&lt;/p&gt;

&lt;p&gt;🔎 Enhanced User Experience&lt;br&gt;
🔎 Resource Management&lt;br&gt;
🔎 Async Operations&lt;br&gt;
🔎 Graceful Termination&lt;/p&gt;

&lt;p&gt;Integrating CancellationToken in your .NET Core applications is a small change that can have a big impact. It enhances performance, improves user experience, and helps in resource management. 🛠️&lt;/p&gt;

&lt;p&gt;When to Use CancellationToken?&lt;/p&gt;

&lt;p&gt;🔹 API Requests=&amp;gt; Cancel ongoing API calls if the user navigates away or the request takes too long.&lt;br&gt;
🔹 Background Services=&amp;gt; Terminate background tasks gracefully during application shutdown or restarts.&lt;br&gt;
🔹 Parallel Tasks=&amp;gt; Manage parallel operations efficiently, especially when one task's result might affect others.&lt;br&gt;
This Example Below is not recommended For Production its just for learning Purposes.&lt;br&gt;
What are your experiences with CancellationToken? Share your thoughts and let's discuss! 💬👇&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1osajyf8okb68eqydbes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1osajyf8okb68eqydbes.png" alt="Image description" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>🚀 🚀 Working with hierarchical data in .Net Core using the hierarchyid data type.(.Net Core 8) 🚀 🚀</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Tue, 02 Jul 2024 16:48:55 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/working-with-hierarchical-data-in-net-core-using-the-hierarchyid-data-typenet-core-8-1315</link>
      <guid>https://forem.com/ahmedshahjr/working-with-hierarchical-data-in-net-core-using-the-hierarchyid-data-typenet-core-8-1315</guid>
      <description>&lt;p&gt;🚀 HierarchyId Data Type &lt;/p&gt;

&lt;p&gt;The hierarchyid data type was introduced with SQL Server 2008. It’s specifically designed to represent and manipulate hierarchical data. &lt;/p&gt;

&lt;p&gt;Hierarchical data structures contain parent-child relationships, and hierarchyid provides an efficient way to store and query such data. &lt;/p&gt;

&lt;p&gt;In the context of databases, both Azure SQL and SQL Server support this data type. &lt;/p&gt;

&lt;p&gt;🚀 Querying Hierarchical Data &lt;/p&gt;

&lt;p&gt;Once you’ve stored hierarchical data using hierarchyid, you can perform various queries:Finding Ancestors and Dependents: You can query for ancestors (parents) and dependents (children) of specific items. &lt;/p&gt;

&lt;p&gt;💡  Depth-Based Queries &lt;/p&gt;

&lt;p&gt;Retrieve all items at a certain depth within the hierarchy. &lt;/p&gt;

&lt;p&gt;🚀 Benefits of Using HierarchyId &lt;/p&gt;

&lt;p&gt;It simplifies querying hierarchical data, making it easier and faster. &lt;/p&gt;

&lt;p&gt;The hierarchyid type is more aligned with .NET norms than SqlHierarchyId. It’s designed to work seamlessly with Entity Framework Core (EF Core). &lt;/p&gt;

&lt;p&gt;hierarchyid is a valuable tool for managing hierarchical data in .NET Core applications. 🌟 If you have any specific questions or need further assistance, feel free to ask! 😊 &lt;/p&gt;

&lt;p&gt;Github Documentation =&amp;gt; &lt;a href="https://github.com/efcore/EFCore.SqlServer.HierarchyId" rel="noopener noreferrer"&gt;https://github.com/efcore/EFCore.SqlServer.HierarchyId&lt;/a&gt; &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>dotnet</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>🔑 Keyed Services in .NET Core 8: The Death of the Factory Pattern? 🔑</title>
      <dc:creator>Ahmed Shah</dc:creator>
      <pubDate>Tue, 07 May 2024 04:12:22 +0000</pubDate>
      <link>https://forem.com/ahmedshahjr/keyed-services-in-net-core-8-the-death-of-the-factory-pattern-41ff</link>
      <guid>https://forem.com/ahmedshahjr/keyed-services-in-net-core-8-the-death-of-the-factory-pattern-41ff</guid>
      <description>&lt;p&gt;In the world of .NET Core 8, we're always looking for ways to write cleaner, more maintainable code. One of the most significant recent developments in this area is the introduction of "Keyed Services" 🎉.&lt;/p&gt;

&lt;p&gt;Keyed Services allow us to register multiple implementations of an interface with a unique key 🔑. We can then retrieve the specific implementation we need at runtime using this key. This is a significant improvement over the traditional Factory Pattern, where we had to manually control the creation of our objects 🏭.&lt;/p&gt;

&lt;p&gt;With this approach, we no longer need to create complex factories or use service locators. Instead, we can rely on the built-in dependency injection container to handle this for us 🧰.&lt;/p&gt;

&lt;p&gt;Does this mean the Factory Pattern is dead 💀? Not necessarily. There are still scenarios where the Factory Pattern might be the right choice. However, Keyed Services provide a powerful alternative that can simplify our code and make it more maintainable 🚀.&lt;/p&gt;

&lt;p&gt;What are your thoughts on this? Have you used Keyed Services in your projects?&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz3zotm6vnhl39i096ioq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz3zotm6vnhl39i096ioq.png" alt="Image description" width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
