Skip to content

refactor(service-config): Restructure service registration logic#1127

Merged
hishamco merged 1 commit intosimplcommerce:masterfrom
KaranChadha10:refactor/restructure-program.cs
Apr 5, 2025
Merged

refactor(service-config): Restructure service registration logic#1127
hishamco merged 1 commit intosimplcommerce:masterfrom
KaranChadha10:refactor/restructure-program.cs

Conversation

@KaranChadha10
Copy link

Description

This PR contains the following points:

  • Refactoring the code from Program.cs to ServiceCollectionExtensions.cs class
  • Move service configuration code from program.cs to ServiceCollectionExtensions.
  • Group related services into logical methods
  • No functionality changes, only code organization

{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "SimplCommerce API", Version = "v1" });
});
builder.Services.ConfigureModules();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the moved registration is not a part of the modules configuration?!!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hishamco Could you please point out which specific registrations you feel don't belong in the modules configuration? I'd like to understand the intended organization better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

48-51, 78

@KaranChadha10 KaranChadha10 force-pushed the refactor/restructure-program.cs branch from 80f2728 to e651bcf Compare April 4, 2025 16:52
@KaranChadha10 KaranChadha10 requested a review from hishamco April 4, 2025 16:53
@KaranChadha10
Copy link
Author

@hishamco comments addressed, kindly review the PR, thanks.

/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add module services to.</param>
/// <returns>The same service collection so that multiple calls can be chained.</returns>
public static IServiceCollection ConfigureModules(this IServiceCollection services)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm agree with this extension, please revert the others, coz the order sometimes is matter

@KaranChadha10 KaranChadha10 force-pushed the refactor/restructure-program.cs branch from e651bcf to 23f6cc7 Compare April 5, 2025 00:18
@KaranChadha10 KaranChadha10 force-pushed the refactor/restructure-program.cs branch from 23f6cc7 to e74b0ee Compare April 5, 2025 00:21
@KaranChadha10 KaranChadha10 requested a review from hishamco April 5, 2025 00:21
@KaranChadha10
Copy link
Author

Addressed pr comments, @hishamco please verify, thanks.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IdentityModel.Tokens.Jwt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last note make sure from the added usings

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was already there I have just Removed ununsed usings and sorted them alphabetically
image

@KaranChadha10 KaranChadha10 requested a review from hishamco April 5, 2025 06:51
@hishamco hishamco merged commit a9531d5 into simplcommerce:master Apr 5, 2025
9 of 10 checks passed
@KaranChadha10 KaranChadha10 deleted the refactor/restructure-program.cs branch April 5, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants