VirtoCommerce / vc-module-customer

Contacts management module
Other
14 stars 22 forks source link

Dependency injection for MemberDocumentChangesProvider #245

Closed VikasVikas593 closed 4 months ago

VikasVikas593 commented 4 months ago

Description: Dependency injection for MemberDocumentChangesProvider is done thor' interface rather than concrete class to ease the extension / custom modules

References

QA-test:

Jira-link:

Artifact URL:

vc-ci commented 4 months ago

Reveiw task created: https://virtocommerce.atlassian.net/browse/VCST-1414

CLAassistant commented 4 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Vikas seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

OlegoO commented 4 months ago

@VikasVikas593

The new code forces the use of any first implementation of IIndexDocumentChangesProvider. However, in this context, we specifically need MemberDocumentChangesProvider.

Solution: To ensure MemberDocumentChangesProvider is used, create a custom implementation and override the DI registration as shown below:

public class CustomMemberDocumentChangesProvider : MemberDocumentChangesProvider
{
    // Custom implementation
}
serviceCollection.AddSingleton<MemberDocumentChangesProvider, CustomMemberDocumentChangesProvider>();

This way, the correct provider is used, and you have the flexibility to override it with a custom implementation if needed.