<?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: Jervie Gono</title>
    <description>The latest articles on Forem by Jervie Gono (@jervie_gono).</description>
    <link>https://forem.com/jervie_gono</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%2F3617753%2F2bf2d709-6879-478d-89d4-b0c824d627fd.jpg</url>
      <title>Forem: Jervie Gono</title>
      <link>https://forem.com/jervie_gono</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jervie_gono"/>
    <language>en</language>
    <item>
      <title>Part 3 of My First .NET Core Web API Project: Documenting the Rookie Mistakes and Wins on the Way to a Job.</title>
      <dc:creator>Jervie Gono</dc:creator>
      <pubDate>Sun, 23 Nov 2025 01:32:22 +0000</pubDate>
      <link>https://forem.com/jervie_gono/part-3-of-my-first-net-core-web-api-project-documenting-the-rookie-mistakes-and-wins-on-the-way-pam</link>
      <guid>https://forem.com/jervie_gono/part-3-of-my-first-net-core-web-api-project-documenting-the-rookie-mistakes-and-wins-on-the-way-pam</guid>
      <description>&lt;h2&gt;
  
  
  Creating Identity Entities
&lt;/h2&gt;

&lt;p&gt;We will now Proceed on Creating Authentication and Authorization&lt;br&gt;
Which where we will be using Asp.netcore Identity&lt;/p&gt;

&lt;p&gt;We need 2 Entities:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ApplicationUser&lt;/li&gt;
&lt;li&gt;ApplicationRole&lt;/li&gt;
&lt;/ol&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%2Frjsoibztfvlmf5ibrzzd.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%2Frjsoibztfvlmf5ibrzzd.png" alt=" " width="282" height="79"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Application User will be used for User Account and doesn't have any connection to our other entities such categories or products. This where Account will handle Authentication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The application Role is basically the Role would be assigned from user. In our case we will assigning role base on their emails.&lt;/strong&gt;&lt;br&gt;
We will also creating 3 Roles&lt;br&gt;
-Admin&lt;br&gt;
-Seller&lt;br&gt;
-Costumer&lt;/p&gt;
&lt;h2&gt;
  
  
  Configuration and Fluent Api
&lt;/h2&gt;

&lt;p&gt;Using &lt;strong&gt;IEntityTypeConfiguration&amp;lt;&amp;gt;&lt;/strong&gt;&lt;br&gt;
-We will be using this for extensively configuring database models and relationships.&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%2Fvuxx2s5l80zoc1zv0a89.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%2Fvuxx2s5l80zoc1zv0a89.png" alt=" " width="325" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ApplicationUserConfiguration: This were the ApplicationUser configured it's properties:&lt;/li&gt;
&lt;/ul&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%2Fgvr2i2j7d81bjr3u92ua.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%2Fgvr2i2j7d81bjr3u92ua.png" alt=" " width="800" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;it's properties and relationships&lt;br&gt;
-CategoryConfiguration: This were the Category configured it's properties :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void Configure(EntityTypeBuilder&amp;lt;Category&amp;gt; builder)
{
    builder.ToTable("Categories");

    builder.HasKey(c =&amp;gt; c.CategoryId);

    builder.Property(c =&amp;gt; c.Name)
        .IsRequired()
        .HasMaxLength(100);

    builder.Property(c =&amp;gt; c.Description)
        .HasMaxLength(500);

    //relationships to seller and parent category
    builder.HasOne(c =&amp;gt; c.Seller)
        .WithMany(x =&amp;gt; x.Categories)
        .HasForeignKey(c =&amp;gt; c.SellerId)
        .OnDelete(DeleteBehavior.SetNull);

    //relationship for parent category
    builder.HasOne(c =&amp;gt; c.ParentCategory)
        .WithMany(c =&amp;gt; c.SubCategories)
        .HasForeignKey(c =&amp;gt; c.ParentCategoryId)
        .OnDelete(DeleteBehavior.Restrict);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;And the other configuration follow the same pattern.&lt;/strong&gt;&lt;br&gt;
Also doing configuration requires understanding about your own Validation. Whether it was fluent validation or Data annotation.&lt;/p&gt;
&lt;h2&gt;
  
  
  Database Migration and Update Database
&lt;/h2&gt;

&lt;p&gt;We are adding the IdentityDbContext here and we will also apply configuration that we did using ApplyConfigurationsFromAssembly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; public class ApplicationDbContext(DbContextOptions&amp;lt;ApplicationDbContext&amp;gt; options) : IdentityDbContext&amp;lt;ApplicationUser, ApplicationRole, Guid&amp;gt;(options)
 {
     public virtual DbSet&amp;lt;ApplicationUser&amp;gt; ApplicationUsersDb { get; set; } = null!;
     public virtual DbSet&amp;lt;Category&amp;gt; CategoriesDb { get; set; } = null!;
     public virtual DbSet&amp;lt;Product&amp;gt; ApplicationRolesDb { get; set; } = null!;
     public virtual DbSet&amp;lt;Order&amp;gt; OrderDb { get; set; } = null!;
     public virtual DbSet&amp;lt;OrderItem&amp;gt; OrderItemDb { get; set; } = null!;
     public virtual DbSet&amp;lt;Review&amp;gt; ReviewDb { get; set; } = null!;

     protected override void OnModelCreating(ModelBuilder builder)
     {
         base.OnModelCreating(builder);

         builder.ApplyConfigurationsFromAssembly(typeof(ApplicationDbContext).Assembly);

         builder.ApplyConfigurationsFromAssembly(typeof(CategoryConfiguration).Assembly);
         builder.ApplyConfigurationsFromAssembly(typeof(ProductConfiguration).Assembly);
         builder.ApplyConfigurationsFromAssembly(typeof(OrderItemConfiguration).Assembly);
         builder.ApplyConfigurationsFromAssembly(typeof(OrderConfiguration).Assembly);
         builder.ApplyConfigurationsFromAssembly(typeof(ReviewConfiguration).Assembly);
     }
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Before we can do Migration&lt;/strong&gt;&lt;br&gt;
We need to add DbContextFactory:&lt;br&gt;
ApplicationDbContextFactory : IDesignTimeDbContextFactory&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt; In a clean architecture, DbContext lives in the Infrastructure project,&lt;br&gt;
But the EF Core migration tools (dotnet ef migrations add ...) run outside your application—&lt;br&gt;
meaning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They cannot access your Program.cs&lt;/li&gt;
&lt;li&gt;They cannot read your DI container&lt;/li&gt;
&lt;li&gt;They do NOT know how to create your DbContext&lt;/li&gt;
&lt;li&gt;They do NOT run the host builder&lt;/li&gt;
&lt;li&gt;They do NOT use your app’s configuration pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that we will just need to go in User-Secret and add our "ConnectionStrings" &lt;/p&gt;

&lt;p&gt;Then Do command: Add-migration and Update-Database&lt;/p&gt;

&lt;p&gt;Now The Migration will be added:&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%2Fnjevqd9wh6af0ntky9of.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%2Fnjevqd9wh6af0ntky9of.png" alt=" " width="309" height="82"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After these steps We can now move to Creating Repositories.&lt;/p&gt;

&lt;p&gt;What's Next?&lt;br&gt;
In Part 4, I will Implement Authentication and Authorization  by doing the Following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating IAuthService in our Core Application and implement that inside services in our infrastructure &lt;/li&gt;
&lt;li&gt;We will also implement Refresh tokens and Jwt tokens in general 
-We will assign the role for user base on their email&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>security</category>
      <category>api</category>
      <category>dotnet</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Part 2 of My First .NET Core Web API Project: Documenting the Rookie Mistakes and Wins on the Way to a Job.</title>
      <dc:creator>Jervie Gono</dc:creator>
      <pubDate>Thu, 20 Nov 2025 23:50:38 +0000</pubDate>
      <link>https://forem.com/jervie_gono/part-2-of-my-first-net-core-web-api-project-documenting-the-rookie-mistakes-and-wins-on-the-way-2p3o</link>
      <guid>https://forem.com/jervie_gono/part-2-of-my-first-net-core-web-api-project-documenting-the-rookie-mistakes-and-wins-on-the-way-2p3o</guid>
      <description>&lt;h2&gt;
  
  
  Creating our Core Domain Entities
&lt;/h2&gt;

&lt;p&gt;It can be challenging to choose our models. &lt;br&gt;
You should consider the long-term effects before committing and making a decision. Initially, I made the decision to include numerous other options, like payment, shopping cart, product variant, product image, and so forth. However, I am aware that the project will take more than six months to complete, and as I am a lone developer, I may not be able to finish it.&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%2Fj0i6msjsdepl0nwh0on4.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%2Fj0i6msjsdepl0nwh0on4.png" alt=" " width="354" height="453"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Core/Entities and their relationship
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; - Category
- &amp;gt; Contains products
- &amp;gt; Navigation: Products collection
- &amp;gt; Used by seller/admin to organize items
- &amp;gt; Self-referencing for subcategories

&amp;gt; - Product
- &amp;gt; Belongs to Category
- &amp;gt; Navigation: OrderItems, Reviews
- &amp;gt; Shown in shop menu to customers
- &amp;gt; Can be added/updated by seller

&amp;gt; - Order
- &amp;gt; Created when a customer buys items
- &amp;gt; Contains multiple OrderItems
- &amp;gt; Status tracks the overall order (Pending, Confirmed, Shipped, Delivered, Cancelled)
- &amp;gt; TotalAmount = sum of OrderItem.UnitPrice * Quantity
- &amp;gt; Managed mostly by backend (seller/admin)

&amp;gt; - OrderItem
- &amp;gt; Snapshot of a product at the time of order
- &amp;gt; Contains UnitPrice, Quantity
- &amp;gt; Navigation to Order and Product

&amp;gt; - Review
- &amp;gt; Written by customer
- &amp;gt; Only creation is needed (no update)
- &amp;gt; Linked to Product and User`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now that our model and entities are completed&lt;br&gt;
We go on to our Dto. Data Transfer Object (DTO)&lt;br&gt;
Planning is necessary in various ways.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//our Dtos category for httpPost
 public record CategoryRequestDto
 {
     public string Name { get; init; } = string.Empty;
     public string? Description { get; init; }
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why are records being used here?&lt;br&gt;
Because we are striving for immutability, which classes do not have&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%2F1hkuhuweev6nicm9k2ht.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%2F1hkuhuweev6nicm9k2ht.png" alt=" " width="357" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PS: We also need to put Enums in Shared, Why? same reason for Dtos: Dependency Management.&lt;/p&gt;

&lt;p&gt;Also, Enums often represent fundamental, non-changing data points that are used across multiple layers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validation
&lt;/h2&gt;

&lt;p&gt;We're setting a standard here: Fluent Validation is our primary validation tool. While the built-in Data Annotations are fine for quick setups, we're phasing them out for consistency and enterprise readiness.&lt;/p&gt;

&lt;p&gt;In the world of real-deal, production-level applications—especially larger ones—Fluent Validation is the industry favorite. Getting comfortable with its clear, code-based approach now is a huge win for future projects.&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%2F4eay5rd8mdfoj80x1jn9.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%2F4eay5rd8mdfoj80x1jn9.png" alt=" " width="349" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sample code:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;internal class CategoryRequestValidation : AbstractValidator&amp;lt;CategoryRequestDto&amp;gt;
{
    protected CategoryRequestValidation()
    {
        RuleFor(x =&amp;gt; x.Name)
            .NotEmpty().WithMessage("Category name is required.")
            .MaximumLength(100).WithMessage("Category name must not exceed 100 characters.");

        RuleFor(x =&amp;gt; x.Description)
            .MaximumLength(500).WithMessage("Category description must not exceed 500 characters.");
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Lastly we just register it in our Dependency Injection
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/// &amp;lt;summary&amp;gt;
/// Creates extension methods for registering services in the Infrastructure layer.
/// &amp;lt;/summary&amp;gt;
public static class DependencyInjection
{
    public static IServiceCollection AddInfrastructure(this IServiceCollection services)
    {
        #region
        //Category Validation
        services.AddValidatorsFromAssemblyContaining&amp;lt;CategoryRequestValidation&amp;gt;();
        services.AddValidatorsFromAssemblyContaining&amp;lt;CategoryUpdateValidation&amp;gt;();
//The rest of Codes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;In Part 3, I'll dive into implementing the base architecture with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating DbContext&lt;/li&gt;
&lt;li&gt;Configuring Secret User&lt;/li&gt;
&lt;li&gt;Registering services in Program.cs&lt;/li&gt;
&lt;li&gt;Prepare for Identity&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>api</category>
      <category>dotnet</category>
      <category>beginners</category>
      <category>career</category>
    </item>
    <item>
      <title>My First .NET Core Web API Project: Documenting the Rookie Mistakes and Wins on the Way to a Job.</title>
      <dc:creator>Jervie Gono</dc:creator>
      <pubDate>Wed, 19 Nov 2025 03:32:27 +0000</pubDate>
      <link>https://forem.com/jervie_gono/my-first-net-core-web-api-project-documenting-the-rookie-mistakes-and-wins-on-the-way-to-a-job-23ci</link>
      <guid>https://forem.com/jervie_gono/my-first-net-core-web-api-project-documenting-the-rookie-mistakes-and-wins-on-the-way-to-a-job-23ci</guid>
      <description>&lt;h2&gt;
  
  
  The Blueprint - Planning My E-Commerce API Architecture
&lt;/h2&gt;

&lt;h2&gt;
  
  
  My First .NET Core Web API Project: Part 1 - Architecture &amp;amp; Planning
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why an E-Commerce API?
&lt;/h2&gt;

&lt;p&gt;When I decided to build my portfolio project, I knew I needed something that would demonstrate real-world skills. An e-commerce API was perfect because it touches on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User management (authentication, profiles)&lt;/li&gt;
&lt;li&gt;Product catalog (CRUD, search, pagination)
&lt;/li&gt;
&lt;li&gt;Business logic (inventory, orders, payments)&lt;/li&gt;
&lt;li&gt;Security (data isolation, input validation)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The architecture decision: Clean Architecture
&lt;/h2&gt;

&lt;p&gt;I almost started with a traditional layered architecture, but then I discovered Clean Architecture. Here's why I chose it: &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%2Ft53q0q1cgvmukkw4objp.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%2Ft53q0q1cgvmukkw4objp.png" alt=" " width="736" height="651"&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%2F4n4znoxd8glvr2nhvm0q.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%2F4n4znoxd8glvr2nhvm0q.png" alt=" " width="512" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ecommerce/&lt;br&gt;
├── API/ # ASP.NET Core Web API&lt;br&gt;
├── Core/ # Domain models, business logic&lt;br&gt;
├── Infrastructure/# Data access, external services&lt;br&gt;
└── Shared/ # DTOs, common utilities&lt;/p&gt;

&lt;h2&gt;
  
  
  Technology Stack Choices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Backend Framework: ASP.NET Core 8
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why I Chose It&lt;/strong&gt;: Latest features, performance improvements, long-term support&lt;br&gt;
&lt;strong&gt;Learning Experience&lt;/strong&gt;: Initially considered .NET 6 for stability, but embracing the latest version demonstrates adaptability&lt;/p&gt;

&lt;h3&gt;
  
  
  Database: SQLSERVER
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why I Chose It&lt;/strong&gt;: Because it was often most used in .net core projects&lt;br&gt;
&lt;strong&gt;Consideration&lt;/strong&gt;: Using Postgresql is a good choice too, but for this project we choose not to use it. &lt;/p&gt;

&lt;h3&gt;
  
  
  ORM: Entity Framework Core
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why I Chose It&lt;/strong&gt;: Productivity with LINQ + raw SQL control when needed&lt;br&gt;
&lt;strong&gt;Key Learning&lt;/strong&gt;: Understanding when to use LINQ vs direct SQL for performance&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Design Patterns
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. CQRS with MediatR
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Commands for write operations&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;record&lt;/span&gt; &lt;span class="nc"&gt;CreateProductCommand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CreateProductDto&lt;/span&gt; &lt;span class="n"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IRequest&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ResponseType&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ProductDto&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Queries for read operations  &lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;record&lt;/span&gt; &lt;span class="nc"&gt;GetProductByIdQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Guid&lt;/span&gt; &lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IRequest&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ResponseType&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ProductDto&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  We will also adding Repository so our project don't have to be strictly tied in any SQL
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public interface IProductRepository
{
    Task&amp;lt;Product&amp;gt; GetByIdAsync(Guid id);
    Task&amp;lt;PaginatedResult&amp;lt;Product&amp;gt;&amp;gt; GetPaginatedAsync(PaginationRequest request);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;In Part 2, I'll dive into implementing the base architecture with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dependency injection configuration&lt;/li&gt;
&lt;li&gt;Models&lt;/li&gt;
&lt;li&gt;DTOs&lt;/li&gt;
&lt;li&gt;Enums
-Validation&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dotnet</category>
      <category>architecture</category>
      <category>career</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
