-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
[Suggestion] Generic IServiceFactory to reduce repetitive code #1003
Comments
@adearriba Thanks for the suggestion! I like that a lot, I think I may have even had something similar in a git stash that I'd been experimenting with as well. The only thing I'm concerned about is the PartnerService, which uses the I'm not sure how we'd make it work so that you can't use |
Thanks, @nozzlegear! The The current template doesn't work for public interface IPartnerServiceFactory
{
/// Creates a new instance of the <see cref="IPartnerService" /> with the given credentials.
/// <param name="partnerOrganizationId">Your Shopify Partner organization ID. This can be found on your Shopify Partner account settings page.</param>
/// <param name="accessToken">An API access token for the shop.</param>
IPartnerService Create(long partnerOrganizationId, string accessToken);
/// Creates a new instance of the <see cref="IPartnerService" /> with the given credentials.
/// <param name="credentials">Credentials for authenticating with the Shopify API.</param>
IPartnerService Create(ShopifyPartnerApiCredentials credentials);
} The other option is to enforce the internal interface IServiceFactory<TInterface, TCredentials>
where TInterface: IShopifyService
where TCredentials : class
{
/// Creates a new instance of the <see cref="TInterface" /> with the given credentials.
/// <param name="credentials">Credentials for authenticating with the Shopify API.</param>
TInterface Create(TCredentials credentials);
} |
Awesome, thanks for giving your thoughts! I like the first option I think, it doesn't make sense to go through all that extra work for just one outlier with the PartnerService. |
Hello,
This is just a proposal to have a generic IServiceFactory interface instead of individual factory interfaces.
The template will change to:
The text was updated successfully, but these errors were encountered: