Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup ISmsService #15142

Merged
merged 2 commits into from
Jan 22, 2024
Merged

Cleanup ISmsService #15142

merged 2 commits into from
Jan 22, 2024

Conversation

MikeAlhayek
Copy link
Member

No description provided.

@hishamco
Copy link
Member

While you working on SMS again, I'm still worrying why you didn't use KeyedServices instead of resolving different providers yourself?!!

@MikeAlhayek
Copy link
Member Author

Because with keyed-services, you can't do this

.Where(entry => entry.Value.IsEnabled)
.Select(entry => new SelectListItem(entry.Key, entry.Key))

You don't have access to the keys.

@hishamco
Copy link
Member

That's why we need the PR #15100. IMHO let us:

  1. Revert the PR changes
  2. Use the strategy pattern as you did before, but using the keyed services under the hood

@MikeAlhayek
Copy link
Member Author

MikeAlhayek commented Jan 21, 2024

@hishamco
I don't want to use keyed service for this.

This approach has an advantage over keyed service where we don't need to add extra services to the DI container since these provider are resolved without the being registered into the container. Also, it has the IsEnable flag for each service where one can enable/disable provider.

Also, I don't like that we have to implement a workaround for keyed-services in OC.

In this PR, I am just doing some cleanup to simplify the service

@hishamco
Copy link
Member

This approach has an advantage over keyed service where we don't need to add extra services to the DI container since these provider are resolved without the being registered into the container. Also, it has the IsEnable flag for each service where one can enable/disable provider.

There's no extra service, what you are done is keeping the provider name in the options itself, which is the first time I saw in the Orchard Core code-base since the beginning

Also, I don't like that we have to implement a workaround for keyed-services in OC.

This is another thing, we already did something similar in Localization while not supporting ASP.NET Core, don't forget we can't run ASP.NET Core team in something we need

Comment on lines 8 to +9
private readonly ISmsProviderResolver _smsProviderResolver;
private ISmsProvider _provider;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private readonly ISmsProviderResolver _smsProviderResolver;
private ISmsProvider _provider;
private ISmsProvider _provider;
private readonly ISmsProviderResolver _smsProviderResolver;

Copy link
Member Author

Choose a reason for hiding this comment

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

I usually leave the static variables top, then readonly then the writable privates. It's done that way everywhere

Copy link
Member

Choose a reason for hiding this comment

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

You're right

@MikeAlhayek MikeAlhayek merged commit f479e47 into main Jan 22, 2024
3 checks passed
@MikeAlhayek MikeAlhayek deleted the ma/sms-service-cleanup branch January 22, 2024 17:42
Skrypt pushed a commit that referenced this pull request Jan 25, 2024
Skrypt pushed a commit that referenced this pull request Jan 25, 2024
^ This is the 1st commit message:

Add GetCulture() extension method

^ This is the commit message #2:

Cleanup ISmsService (#15142)


^ This is the commit message #3:

Fix TheAdminTheme layout margin and padding (#15143)


^ This is the commit message #4:

Fix SectionDisplayDriver prefix (#15123)


^ This is the commit message #5:

Prefill template name when creating a template. (#15145)


^ This is the commit message #6:

Set the User Localization feature priority

^ This is the commit message #7:

Fix issue with default culture not selected

When currentUserCulture is null or supportedCulture doesn't contain currentUserCulture.

^ This is the commit message #8:

Update the height of the admin content (#15153)


^ This is the commit message #9:

Eliminate the anti-discovery pattern in Elasticsearch (#15134)


^ This is the commit message #10:

Renaming and cleaning up search services (#15156)


^ This is the commit message #11:

mkdocs-material 9.5.5
Skrypt added a commit that referenced this pull request Jan 25, 2024
…themes (#11243)

Cleanup ISmsService (#15142)

Fix TheAdminTheme layout margin and padding (#15143)

Fix SectionDisplayDriver prefix (#15123)

Prefill template name when creating a template. (#15145)

Set the User Localization feature priority

Fix issue with default culture not selected

When currentUserCulture is null or supportedCulture doesn't contain currentUserCulture.

Update the height of the admin content (#15153)

Eliminate the anti-discovery pattern in Elasticsearch (#15134)

Renaming and cleaning up search services (#15156)

mkdocs-material 9.5.5

User Timezone settings refresh

Originally from Hisham

revert manifest
hishamco pushed a commit that referenced this pull request Feb 1, 2024
urbanit pushed a commit to urbanit/OrchardCore that referenced this pull request Mar 18, 2024
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