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

Add transient service provider package #16

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

N31TH3R
Copy link

@N31TH3R N31TH3R commented Mar 3, 2025

No description provided.

@N31TH3R N31TH3R requested a review from YuriyDurov March 3, 2025 13:32
/// <summary>
/// Provides a transient service provider that delegates service resolution
Copy link
Member

Choose a reason for hiding this comment

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

This is the provider now

/// <param name="serviceType">The type of service to resolve.</param>
/// <returns>The requested service instance or null if not found.</returns>
public object? GetService(Type serviceType)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just inheritdoc?

Also, I believe this could use the following form:

object? IServiceProvider.GetService(Type serviceType)

for additional clarity regarding what this does and why it is here

@@ -2,6 +2,11 @@

namespace BitzArt.DependencyInjection;

/// <summary>
/// Factory for creating and managing transient service providers.
Copy link
Member

Choose a reason for hiding this comment

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

Does not seem like this brings anything new to the table, while this class could use some explanation

public static class ServiceCollectionExtensions
{
/// <summary>
/// Registers the factory as a singleton and adds a transient registration that retrieves a provider from the factory.
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary for the package's user to know how exactly the factory and the providers are registered under the hood (singleton / transient, etc.)?

I believe this could use additional explanation on how the factory and the providers are connected. Consider adding something like the following:

/// Registers an <see cref="TransientServiceProviderFactory"/>

and referring to the TransientServiceProvider somewhere in a similar fashion.

This could give the reader a way to figure out more about each of these classes by clicking their respective links in the summary here.

@N31TH3R N31TH3R force-pushed the add-transient-service-provider branch from b05e663 to dce9982 Compare March 6, 2025 08:58
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